Closed hmongdev closed 8 months ago
it's because of tanstack query v5, use this code instead:
export const useGetPosts = () => { return useInfiniteQuery({ queryKey: [QUERY_KEYS.GET_INFINITE_POSTS], queryFn: getInfinitePosts as any, initialPageParam: 0, getNextPageParam: (lastPage: any) => { if (lastPage && lastPage.documents.length === 0) { return null; }
const lastId = lastPage.documents[lastPage.documents.length - 1].$id;
return lastId;
},
}); };
Thanks for the reply. I actually figured out it was due to initialPageParam: 0
I was able to get it working, thanks!
it's because of tanstack query v5, use this code instead:
export const useGetPosts = () => { return useInfiniteQuery({ queryKey: [QUERY_KEYS.GET_INFINITE_POSTS], queryFn: getInfinitePosts as any, initialPageParam: 0, getNextPageParam: (lastPage: any) => { if (lastPage && lastPage.documents.length === 0) { return null; }
const lastId = lastPage.documents[lastPage.documents.length - 1].$id; return lastId; },
}); };
thanks bro
Your a legend fuzanu had the same issue
I'm running into a problem during deployment. I get this
No overload matches this call
error.Found this.
It says I'm passing a parameter that doesn't match the specified overloads.
Thing is, my code is identical to the finished project.