-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Describe the bug
In my app when the user changes the language, I clear the query client with queryClient.clear()
because I want to remove any cache since it has data with invalid language, but when I later invalidateQueries with queryClient.invalidateQueries([queryKey])
it does not invalidate the query.
This only happens after clearing the query client
Your minimal, reproducible example
https://codesandbox.io/s/late-river-h8mt4h?file=/src/App.js
Steps to reproduce
- press on
invaldate
and notice how it calls the api - press on clear(not sure why it does not refetch but that is not the bug I am talking about)
- press on
invalidate
and it will no longer work
Expected behavior
I expect query invalidate to work after clearing the query client just as it was before clearing it
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Macos
- Browser: Firefox
Also on iphone. I experience it on my mobile app with react native
TanStack Query version
4.23.0
TypeScript version
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels