You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to understand behaviour when invalidating inactive queries.
client.invalidateQueries(CACHE_KEY)
I was assuming that the query would be refetched the next time it is activated (when the useQuery is called).
This only works if the refetchOnMount is true, but that would mean refetching even non invalidated queries.
I know that I can provide refetchInactive in the invalidateQueries call, but that would start the refetch immediately, which I would rather avoid.
I could also remove the query, but that would break pagination in case of an Infinite query.
Is there any way of refetching invalidated queries on mount without removing them, or refetching them always?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to understand behaviour when invalidating inactive queries.
I was assuming that the query would be refetched the next time it is activated (when the useQuery is called).
This only works if the
refetchOnMount
is true, but that would mean refetching even non invalidated queries.I know that I can provide
refetchInactive
in theinvalidateQueries
call, but that would start the refetch immediately, which I would rather avoid.I could also remove the query, but that would break pagination in case of an Infinite query.
Is there any way of refetching invalidated queries on mount without removing them, or refetching them always?
Here is a live example: https://stackblitz.com/edit/react-ts-vnkmge?file=index.tsx,package.json
Thx
Beta Was this translation helpful? Give feedback.
All reactions