mirror of
https://github.com/maotoumao/MusicFreeDesktop.git
synced 2026-06-20 09:32:17 +08:00
fix: #382
This commit is contained in:
@@ -366,7 +366,11 @@ export function SongTable({
|
||||
activeDragIdRef.current = activeDragId;
|
||||
|
||||
// ── 构建列定义 ──
|
||||
const hideSet = useMemo(() => new Set(hideColumns ?? []), [hideColumns]);
|
||||
// NOTE: 按内容(而非引用)稳定化 hideColumns,防止消费侧传入字面量数组时
|
||||
// 每次渲染产生新引用,导致 columns → colGroup → virtuosoComponents 级联重建,
|
||||
// 行 DOM 被销毁重建后浏览器无法在同一元素上触发 dblclick。
|
||||
const hideColumnsKey = (hideColumns ?? []).join(',');
|
||||
const hideSet = useMemo(() => new Set(hideColumns ?? []), [hideColumnsKey]);
|
||||
|
||||
const columns = useMemo<InternalColumn[]>(() => {
|
||||
const cols: InternalColumn[] = [];
|
||||
|
||||
@@ -16,8 +16,11 @@ import { SongTable } from '../../../components/business/SongTable';
|
||||
import { StatusPlaceholder } from '../../../components/ui/StatusPlaceholder';
|
||||
import { ScrollArea } from '../../../components/ui/ScrollArea';
|
||||
import { useStatusColumn, useRowContextMenu, useSelection } from '../hooks';
|
||||
import type { HideableColumn } from '../../../components/business/SongTable';
|
||||
import { filteredLocalMusicAtom, albumListAtom } from '../store';
|
||||
|
||||
const HIDE_COLUMNS: HideableColumn[] = ['platform', 'album'];
|
||||
|
||||
interface AlbumsTabProps {
|
||||
isEmpty: boolean;
|
||||
searchKeyword: string;
|
||||
@@ -135,7 +138,7 @@ export function AlbumsTab({ isEmpty, searchKeyword }: AlbumsTabProps) {
|
||||
requestStatus={RequestStatus.Done}
|
||||
onRowContextMenu={handleRowContextMenu}
|
||||
statusColumn={statusColumn}
|
||||
hideColumns={['platform', 'album']}
|
||||
hideColumns={HIDE_COLUMNS}
|
||||
{...selectionProps}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -16,8 +16,11 @@ import { SongTable } from '../../../components/business/SongTable';
|
||||
import { StatusPlaceholder } from '../../../components/ui/StatusPlaceholder';
|
||||
import { ScrollArea } from '../../../components/ui/ScrollArea';
|
||||
import { useStatusColumn, useRowContextMenu, useSelection } from '../hooks';
|
||||
import type { HideableColumn } from '../../../components/business/SongTable';
|
||||
import { filteredLocalMusicAtom, artistListAtom } from '../store';
|
||||
|
||||
const HIDE_COLUMNS: HideableColumn[] = ['platform', 'artist'];
|
||||
|
||||
interface ArtistsTabProps {
|
||||
isEmpty: boolean;
|
||||
searchKeyword: string;
|
||||
@@ -113,7 +116,7 @@ export function ArtistsTab({ isEmpty, searchKeyword }: ArtistsTabProps) {
|
||||
requestStatus={RequestStatus.Done}
|
||||
onRowContextMenu={handleRowContextMenu}
|
||||
statusColumn={statusColumn}
|
||||
hideColumns={['platform', 'artist']}
|
||||
hideColumns={HIDE_COLUMNS}
|
||||
{...selectionProps}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -16,8 +16,11 @@ import { RequestStatus } from '@common/constant';
|
||||
import { SongTable } from '../../../components/business/SongTable';
|
||||
import { StatusPlaceholder } from '../../../components/ui/StatusPlaceholder';
|
||||
import { useStatusColumn, useRowContextMenu, useSelection } from '../hooks';
|
||||
import type { HideableColumn } from '../../../components/business/SongTable';
|
||||
import { filteredLocalMusicAtom, folderListAtom, type FolderAggregation } from '../store';
|
||||
|
||||
const HIDE_COLUMNS: HideableColumn[] = ['platform'];
|
||||
|
||||
interface FoldersTabProps {
|
||||
isEmpty: boolean;
|
||||
searchKeyword: string;
|
||||
@@ -147,7 +150,7 @@ function FolderSongList({ folder, searchKeyword }: { folder: string; searchKeywo
|
||||
requestStatus={RequestStatus.Done}
|
||||
onRowContextMenu={handleRowContextMenu}
|
||||
statusColumn={statusColumn}
|
||||
hideColumns={['platform']}
|
||||
hideColumns={HIDE_COLUMNS}
|
||||
{...selectionProps}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -22,8 +22,13 @@ import {
|
||||
import { ArtistsTab } from './components/ArtistsTab';
|
||||
import { AlbumsTab } from './components/AlbumsTab';
|
||||
import { FoldersTab } from './components/FoldersTab';
|
||||
import type { HideableColumn } from '../../components/business/SongTable';
|
||||
import './index.scss';
|
||||
|
||||
// ─── Constants ───
|
||||
|
||||
const HIDE_COLUMNS: HideableColumn[] = ['platform'];
|
||||
|
||||
// ─── Tab 定义 ───
|
||||
|
||||
type LocalMusicTab = 'songs' | 'artists' | 'albums' | 'folders';
|
||||
@@ -172,7 +177,7 @@ export default function LocalMusicPage() {
|
||||
requestStatus={RequestStatus.Done}
|
||||
onRowContextMenu={handleRowContextMenu}
|
||||
statusColumn={statusColumn}
|
||||
hideColumns={['platform']}
|
||||
hideColumns={HIDE_COLUMNS}
|
||||
{...selectionProps}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user