Questions about useInfiniteQuery #8420
Unanswered
vancepatual
asked this question in
Q&A
Replies: 1 comment
-
Been searching in the Discussions since I got no answer perhaps my question was a bit vague sorry for that. This somewhat answered it for me. It seems we do need to do custom implementation to not call the endpoint. For the fetchPreviousPage turns out it is explained in the doc https://tanstack.com/query/latest/docs/framework/react/guides/infinite-queries#what-if-i-want-to-implement-a-bi-directional-infinite-list |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋,
Been playing around with useInfiniteQuery there are some things that I wanted confirmation on the behavior I observed which I found perplexing. I cannot seem to find it in the docs or I must have missed it. Perhaps it can be answered here?
fetchPreviousPage
My Expectation
Observation
fetchNextPage (No question with this one I think that make sense just leaving it here for reference)
Calling fetchPreviousPage or fetchNextPage
My Expectation
Observation
Calling refetch
My Expectation
Observation
Are this behavior expected? Is the expectation that if we want to check cache first before calling the endpoint we create a wrapper around fetchNextPage or fetchPreviousPage to check the InfiniteData and do manual stitching right there?
Or is there an option I'm not aware of, for context been reading this https://tanstack.com/query/latest/docs/framework/react/guides/infinite-queries#infinite-queries
https://tanstack.com/query/latest/docs/framework/react/examples/infinite-query-with-max-pages
Here is a modified example
https://stackblitz.com/edit/tanstack-query-r6sfp6nw?file=src%2Fpages%2Findex.tsx&preset=node
Beta Was this translation helpful? Give feedback.
All reactions