[slightly less scuffed bugfix]: Update table rating/favorite when updated anywhere … (#707)

* [scuffed bugfix]: Update table rating/favorite when updated anywhere else

Modify player store to have temporary state for favorite/rating update
Add effect handler for `virtual-table` to update rating/favorite for players

Note that this does not handle song grid view.
Using a similar handler for gird view did not work, as it appeared to result in inconsistent state.

Finally, this is probably not the optimal solution.
Performance appears fine for ~20k items, but no guarantees.

* restore should update song

* update song rating/favorite/played everywhere except playlist

* special rule for playlists

* use iterator instead
This commit is contained in:
Kendall Garner 2024-09-02 22:31:20 -07:00 committed by GitHub
parent 9d44f0fc08
commit 56c229a5e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 223 additions and 143 deletions

View file

@ -42,6 +42,7 @@ import { NoteCell } from '/@/renderer/components/virtual-table/cells/note-cell';
import { RowIndexCell } from '/@/renderer/components/virtual-table/cells/row-index-cell';
import i18n from '/@/i18n/i18n';
import { formatDateAbsolute, formatDateRelative, formatSizeString } from '/@/renderer/utils/format';
import { useTableChange } from '/@/renderer/hooks/use-song-change';
export * from './table-config-dropdown';
export * from './table-pagination';
@ -475,6 +476,7 @@ export interface VirtualTableProps extends AgGridReactProps {
pagination: TablePaginationType;
setPagination: any;
};
shouldUpdateSong?: boolean;
stickyHeader?: boolean;
transparentHeader?: boolean;
}
@ -492,6 +494,7 @@ export const VirtualTable = forwardRef(
onGridReady,
onGridSizeChanged,
paginationProps,
shouldUpdateSong,
...rest
}: VirtualTableProps,
ref: Ref<AgGridReactType | null>,
@ -506,6 +509,8 @@ export const VirtualTable = forwardRef(
}
});
useTableChange(tableRef, shouldUpdateSong === true);
const defaultColumnDefs: ColDef = useMemo(() => {
return {
lockPinned: true,