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:
parent
9e6a81cb62
commit
01371d0227
1 changed files with 2 additions and 2 deletions
|
@ -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 a new issue