Invalidate query functionality
It is not very clear to me how the method works exactly.
My question is, does it mark the query as invalid and then the other methods dont fetch it again or does it first execute it bring the date upfront and then delete it?
Does it also raise a flag when it invalidates a query?
4 Replies
rival-black•17mo ago
It doesn't remove or mark the query as invalid. Each query has a
staleTime it's a time after which this query data is considered to be old and RQ must run this queryFn to get fresh data from the BE. When you invalidate a query you just mark it as stale immediately, if this query is rendered it will call its queryFn to get fresh data.adverse-sapphireOP•17mo ago
Thank you for explaining.
Next question is for how long are these data kept before being deleted?
mute-gold•17mo ago
gcTime is 5 minutes by default. Unused/unmounted queries will be cleaned once the gcTime is reachedadverse-sapphireOP•17mo ago
Thank you for the reply, will need to read a bit more to understand how ti works