Replies: 1 comment
-
I found this issue thread to be quite helpful - #1151. The recommendation by @huozhi right at the bottom of that conversation is to look at https://swr.vercel.app/docs/advanced/cache#mutate-multiple-keys-from-regex. I don't quite need the regex mutate, but I was able to use the same technique:
This did the trick for me. Though I do find this way a bit indirect and unclear. If the |
Beta Was this translation helpful? Give feedback.
0 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.
-
I'm trying to clear SWR cache on logout and I can see it clearing out all items on the
cache.clear()
call but upon navigating to the Sign-in page the cache seems to be back. Am I missing something?I am on swr version 1.2.2. I've followed the guide here - https://swr.vercel.app/docs/advanced/cache
My Sign-Out button code looks like this:
When I break on
(swrCache as any).clear();
I can see items in there and theclear()
does clear it out.However, on initialization of the sign-in view all of the cache is back! There were no network calls at that point of the load.
Is it possible that I'm clearing a copy of the cache and not the actual cache?
I have tried it with
<SWRConfig>
inApp.tsx
and without it but same result:Any ideas on what I'm missing?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions