mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
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:
@@ -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 };
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user