Skip to content
Discussion options

You must be logged in to vote

I would have expected that if the query is enabled but invalidated or non existent after being removed, it would trigger a auto-refetch on the next render pass. I may be wrong if this is not the intended behavior.

no, that's not what invalidation is doing. react-query will never re-fetch just because you re-render. staleTime defaults to zero, so all queries are instantly "stale" per default.

invalidation marks a query as stale, and it automatically re-fetches active queries (an active query is a query that is currently used by useQuery) right away (not in the next render cycle or so). But since you set refetchActive: false, all that the invalidation is doing is setting the query to stal…

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@priyajeet
Comment options

@priyajeet
Comment options

@priyajeet
Comment options

Answer selected by priyajeet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2629 on September 04, 2021 20:20.