fetchNextPage working via the getNextPageParam method. I do not know how to go about the fetchPreviousPage working, i've tweaked with the getPreviousPageParam method but it doesn't still work. I'll appreciate if anyone can point out how i can fix this. Attached below is the query function:const {
data,
fetchNextPage,
fetchPreviousPage,
error,
isPending,
isFetchingNextPage,
isFetchingPreviousPage,
hasPreviousPage,
hasNextPage,
} = useInfiniteQuery({
queryKey: ['projects'],
queryFn: ({ pageParam = 1 }) => {
return hostFetch(/user/search, {
method: 'POST',
query: {
page: pageParam,
limit: 20,
// order_by: 'id__',
sort: 'DESC',
},
headers: {
Authorization: Bearer ${AuthToken()},
},
body: {
payload: {
status: 'active',
},
},
});
},
initialPageParam: 0,
getNextPageParam: (lastPage, allPages, lastPageParam) => {
if (lastPage.data.length === 0) {
return undefined;
}
return lastPageParam + 1;
},
getPreviousPageParam: (
firstPage,
allPages,
firstPageParam,
pageParam
) => {
if (firstPageParam <= 1) {
return undefined;
}
return pageParam.length - 1;
},
});https://x.com/tan_stack/status/2031128535470104577?s=20
dry-scarlet · 7h ago
https://x.com/powersync_/status/2010721010006552775?s=20
dry-scarlet · 2mo ago
You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 3mo ago