Add pageIndex on infinite query results

- Result selector runs on every page on every fetch, which means that the uniqueId is not immutable. We need a static index on each item since a playlist can have duplicate song ids
This commit is contained in:
jeffvli 2023-01-06 13:48:29 -08:00
parent 9e6a81cb62
commit 01371d0227

View file

@ -49,8 +49,8 @@ export const usePlaylistSongListInfinite = (
(data: InfiniteData<RawSongListResponse | undefined>) => { (data: InfiniteData<RawSongListResponse | undefined>) => {
return { return {
...data, ...data,
pages: data.pages.map((page) => { pages: data.pages.map((page, index) => {
return api.normalize.songList(page, server); return { ...api.normalize.songList(page, server), pageIndex: index };
}), }),
}; };
}, },