-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createInfiniteQuery expects pageParam to be a number #67
Comments
This is a minimal example, and indeed const useGeneratedQuery = createInfiniteQuery({
queryKey: ['key'],
fetcher: (
_variables: {
id: number
},
{ pageParam }
): Promise<{
projects: { id: string; name: string }[]
nextCursor: string
}> => {
return fetch(`/test?cursor=${pageParam}`).then(res => res.json())
},
initialPageParam: '1',
getNextPageParam: lastPage => lastPage.nextCursor,
}) |
Hey, thanks for looking into this! Using your example, I rewrote my query like so:
And compiler no longer complains about initialPageParam & getNextPageParam not returning a number, so there's a progress. However the
Any ideas? |
Basically same problem as here TanStack/query#7458, ReactQuery can work with a non number
pageParam
. Looks like this is not supported in the react-query-kit yet.What I'm trying to achieve - the API I'm working with returns complex cursor that looks like this:
The text was updated successfully, but these errors were encountered: