Cache AND Queries getting wiped from queryClient.
I am honestly stumped on this one. I don't know if it's ClerkAuth or React Query that is the issue here, but when I switch organizations using the org switcher. My cache is completely wiped out even though I have not navigated to another page. Very weird behavior. Anyone have any ideas on how to trace this? I can literally watch the cache state get wiped out in the react dev tools and RQ devtools. I just don't understand how the queries are getting unloaded by a totally different context changing a piece of its own internal state.
2 Replies
other-emerald•3y ago
React Query FAQs
Answering the most frequently asked React Query questions
afraid-scarletOP•3y ago
@TkDodo 🔮 Funny enough, that's exactly the solution I ran into eventually. Turns out Clerk does some kind of force rerender that doesn't trigger the creation of the queryclient instance in the _app.tsx. So once I stored it in state I was able to persist the cache across organization switches.
Thank you @TkDodo 🔮 !