Replies: 2 comments 3 replies
-
One thought i just had is whether I can use the |
Beta Was this translation helpful? Give feedback.
1 reply
-
I think you would need to specify different storage keys, because otherwise, they will overwrite each other. Then, set the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my application, the user can create multiple "accounts". I want the query data of each account to be persisted, so I use the
PersistQueryClientProvider
. I want persisted data to be persisted indefinitely, or until they are garbage collected. So I use the default config forQueryClient
(aka,gcTime
is5
minutes) andInfinity
formaxAge
of persisted. So far so good.The problem I try to solve is that when the user switches accounts, for example, they go from account A to account B, and they stay at account B for longer than 5 minutes, all persisted cached query data of account A will be garbage collected (since they become inactive) and removed from the cache and persisted cache. This is not my intention. I want to garbage-collect query data of the currently connected account. I want only inactive account B query data to be garbage collected after 5 minutes in the above scenario. I want account A cached data to remain in the persister, until the user has connected to account A at which point inactive data of account A can be removed from the cache.
I thought of having 1
queryClient
and 1 persister per account and dynamically update thequeryClient
andpersister
when the user switches accounts, but this doesn't seem to work:I would appreciate some guidance on the matter. What am I missing? Thank you 🙏
Beta Was this translation helpful? Give feedback.
All reactions