Skip to content
Discussion options

You must be logged in to vote

Hm, I haven't used either. I mostly do invalidateQueries.

Tanner answered the question regarding the difference between refetchQueries and invalidateQueries like this:

If I have a user switch accounts, should I run both queryCache.refetchQueries() and queryCache.clear() or just one or the other?

I'm pretty sure that queryCache.clear() just removes the value from the cache, which I think is what you want when a user switches accounts. Once the user visits a page again where the query is observed, it will fetch again because it has no data. If you are certain that the data will be needed immediately, you could refetch it right away.

Alternatively, you could also put the accountId into th…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@transmissions11
Comment options

@weyert
Comment options

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