How to invalidate every single query on Sign Out? #2274
-
Most of my query keys are specific UUID that are used inside the query. On Sign Out page I don't have access to all the UUID that were used to make the query. There is one possibility that new signed in user will have different UUID so I don't need to worry about invalidating it. But I would like global invalidating queries without passing in specific query key. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You can do on logout, you might want removeQueries rather than invalidateQueries though |
Beta Was this translation helpful? Give feedback.
You can do
queryClient.invalidateQueries()
without patenteres and it weil invalidate all of them. Also have a look at fuzzy query key matching: https://react-query.tanstack.com/guides/filters#query-filterson logout, you might want removeQueries rather than invalidateQueries though