refactor item list to use accessor function

This commit is contained in:
jeffvli
2026-01-16 16:34:31 -08:00
parent e2b20eb89b
commit d1aed5007f
39 changed files with 528 additions and 324 deletions
@@ -36,15 +36,16 @@ export const PlaylistListInfiniteGrid = ({
const listQueryFn = api.controller.getPlaylistList;
const { data, onRangeChanged } = useItemListInfiniteLoader({
eventKey: ItemListKey.PLAYLIST,
itemsPerPage,
itemType: LibraryItem.PLAYLIST,
listCountQuery,
listQueryFn,
query,
serverId,
});
const { dataVersion, getItem, getItemIndex, itemCount, loadedItems, onRangeChanged } =
useItemListInfiniteLoader({
eventKey: ItemListKey.PLAYLIST,
itemsPerPage,
itemType: LibraryItem.PLAYLIST,
listCountQuery,
listQueryFn,
query,
serverId,
});
const { handleOnScrollEnd, scrollOffset } = useItemListScrollPersist({
enabled: saveScrollOffset,
@@ -54,12 +55,16 @@ export const PlaylistListInfiniteGrid = ({
return (
<ItemGridList
data={data}
data={loadedItems}
dataVersion={dataVersion}
gap={gap}
getItem={getItem}
getItemIndex={getItemIndex}
initialTop={{
to: scrollOffset ?? 0,
type: 'offset',
}}
itemCount={itemCount}
itemsPerRow={itemsPerRow}
itemType={LibraryItem.PLAYLIST}
onRangeChanged={onRangeChanged}