Add infinite query option to not fetch all pages when refetching #5011
rossmartin
started this conversation in
Ideas
Replies: 1 comment
-
Opened this PR here to add a |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We have successfully integrated infinite queries in a react native app and it is working well. Thank you for all of the work on this. We're using FlashList and the pull to refresh (PTR) functionality with it.
One issue we have is that when you do a PTR and do a
refetch
, all pages are being fetched. We found out that this is the intended behavior:https://redux-toolkit.js.org/rtk-query/usage/infinite-queries#refetching
This issue here also explains the situation - Infinite query always refetch all pages. The workaround is to clear the query
pages
/pageParams
before doing therefetch
.We understand that this behavior is modeled after react query. It would be awesome if there is a way to opt out of this behavior via an option though. Maybe an option named
refetchCachedPages
or something like that.Let's say you're building/using an Instagram like app. If you scroll down and get 30 pages of data and then do a PTR - it doesn't make sense to re-request those existing 30 pages of data just to get the latest page of data. You really only want 1 request to get the latest data. If the user wants to see more content they can scroll down and fetch more data when needed.
Beta Was this translation helpful? Give feedback.
All reactions