Replies: 2 comments
-
+1 |
Beta Was this translation helpful? Give feedback.
-
There is no prefetching of a next page inside an infiniteQuery - there is only fetching it, because there is only one cache entry that consists of multiple pages. So when you are rendering a react component that uses an infinite query, and you fetch the first page and show it, you can then surely fetch the next page as well with The usual way is just to fetch the next page when the user comes close to scrolling to the bottom of the infinite timeline. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to prefetch each next page after the first page is rendered with the useInfiniteQuery.
Problem
I found there's a method of queryClient.prefetchInfiniteQuery.
I tried to use it inside a component just once, after receiving the first batch of data but it ended up rewriting the query data completely, so instead of prefetched data in the array of pages of the query data I have only one page with this next page data in it. I am clearly doing something wrong here and need to figure out how to make it right and expected.
Here's my query
my single prefetch call is this that rewrites results from the first query
Beta Was this translation helpful? Give feedback.
All reactions