Old data dissapears when using useInfiniteQuery

useInfiniteQuery({
queryKey: ["releases"],
initialPageParam: initialNextId,
queryFn: async ({ pageParam }) => {
const result = await getReleases({ limit: 6, cursor: pageParam });
console.log(result, pageParam);
return result.data;
},
getNextPageParam: (lastPage) => lastPage?.nextId,
initialData: {
pageParams: [undefined],
pages: [{ releases: initialReleases, nextId: initialNextId }],
},
});
useInfiniteQuery({
queryKey: ["releases"],
initialPageParam: initialNextId,
queryFn: async ({ pageParam }) => {
const result = await getReleases({ limit: 6, cursor: pageParam });
console.log(result, pageParam);
return result.data;
},
getNextPageParam: (lastPage) => lastPage?.nextId,
initialData: {
pageParams: [undefined],
pages: [{ releases: initialReleases, nextId: initialNextId }],
},
});
When I visit the page, old data is displayed for a split second then dissapears. How can I fix it?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server