How to fetch infiniteQuery out of order #8036
Replies: 1 comment
-
We removed the manual
This is the best idea I can think of, but instead of actually fetching those thousands of pages, I would just have the
and the next thing you want to fetch is 100, you could just insert an "empty page" with
then, calling
just keep in mind that when refetches are done, we always compute the next page param from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We use infinite queries to fetch data for very large smooth scrolling lists. If the user scrolls to the middle, React Query v4 lets us do something like:
fetchNextPage({pageParam: {offset: 10_000, limit: 100}})
. Unfortunately, this is no longer possible in React Query v5. Does anyone have a good pattern on how to do this?So far the best ideas I can think of are:
useEffect
that repeatedly doesfetchNextPage
until we have the required number of items. In a list with 10s of thousands of items, this would be too many requests.Beta Was this translation helpful? Give feedback.
All reactions