Replies: 1 comment 2 replies
-
that is not what invalidation is supposed to do. As you can see here: https://react-query.tanstack.com/guides/query-invalidation invalidation merely marks queries as stale and refetches them. Maybe queryClient.removeQueries is what you are looking for? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
queryClient.invalidateQueries()
is not clearing the queryCache.Even after invalidating all queries, when I make a 2nd request using
useQuery
, it uses the cached response instead of making a new request.To Reproduce
Steps to reproduce the behavior:
Mutation that triggers the invalidation:
Page that makes the query:
my query hook:
Expected behavior
I expect for the cache to be cleared, and for a 2nd new network request to be made when visiting the page.
Screenshots

Desktop (please complete the following information):
Mac
"react-query": "^3.13.0",
Beta Was this translation helpful? Give feedback.
All reactions