Skip to content

refetch vs invalidating query #2468

Answered by TkDodo
ytnytn1 asked this question in Q&A
Jul 16, 2021 · 1 comments · 19 replies
Discussion options

You must be logged in to vote

I'm curious what if instead of invalidation use refetching ? Won't give the same effect?

invalidation is a more "smart" refetching. Refetching will always refetch, even if there are no observers for the query. invalidation will just mark them as stale so that they refetch the next time an observer mounts. For queries with active observers, there is no difference as far as I'm aware.

Replies: 1 comment 19 replies

Comment options

You must be logged in to vote
19 replies
@markivancho
Comment options

@paulosborne
Comment options

@TkDodo
Comment options

@jgarplind
Comment options

@TkDodo
Comment options

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