All QueryCaches immediately removed when using PersistQueryClientProvider #8084
-
I asked a question yesterday, but I've narrowed it down significantly. I found out that React Query provides a plugin for localStorage caching, so I switched to that. This is the relevant code:
As you can see, I have a useEffect that monitors changes to the cache. The behavior seems to me to be very strange: At first, everything appears normal. 6 However, then a 7th "added" event fires, with queryKey Next, an Immediately afterwards, 7 I can't for the life of my figure out what's causing this strange behavior, in particular the removal of every single query in the cache right after the addition of So, what could possibly be triggering the deletion of all of my queries? Thanks for any help in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured out the cause of this issue. Lazy loading certain components was causing the deletion of my query cache, and when I switched to synchronous import this resolved the problem. |
Beta Was this translation helpful? Give feedback.
I figured out the cause of this issue. Lazy loading certain components was causing the deletion of my query cache, and when I switched to synchronous import this resolved the problem.