How to refetch only if stale during screen focus in react native? #9554
-
We use React Query heavily in our React Native app, but there’s one pain point we haven’t found a clean solution for yet. The official docs suggest a small a) Double-fetching in dev (strict) mode b) It sidesteps React Query’s built-in protections The docs do mention query filters, but in my experience they either don’t behave as expected in this React Native scenario, or they just don’t solve this particular problem. Has anyone else tackled this more cleanly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
instead of calling queryClient.refetchQueries({ stale: true, type: 'active' }) This way only queries older than their staleTime will refetch. |
Beta Was this translation helpful? Give feedback.
instead of calling
refetch()
everywhere, do:This way only queries older than their staleTime will refetch.
#4016