Skip to content

Populating initial pageParam for infinite queries #6170

Answered by TkDodo
lmcq asked this question in Q&A
Discussion options

You must be logged in to vote

however the problem is that results are still cached under an undefined pageParam.

this should work in v5 (released yesterday) because the syntax changed:

useInfiniteQuery({
  queryKey: ['products', filters],
  queryFn: ({ pageParam }) => ...)
  initialPageParam: searchParams.get('page')
)

we don't cache under undefined anymore, but under whatever initialPageParam returns.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lmcq
Comment options

Answer selected by lmcq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants