PersistQueryClientProvider : Is there a way to remove certain queries from memory without removing them from the persistor? #8438
-
In my app, the logged in users can have profiles in each account (Think similar to profiles on Netflix or Prime Video but with more differences). Each profile has its own unique data that is fetched using my endpoints. The total data stored for each profile could go as high as 100mb. I am using PersistQueryClientProvider with IndexedDB as a persistor. All my query keys follow the format below:
I have noticed that when a user has multiple profiles data and is using an android device with low ram (4gb), having the queries for multiple profiles loaded in the memory is slowing down the UI. Is there a way to only load queries for the current profile in memory and leave the other profile data in IndexedDB persistor? When the user signs out of a profile, I would like to remove the query data for that profile from memory while a copy being maintained in the persistor. This data would get loaded back when the user signs into a profile. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
No, with PersistQueryClient, what you have in memory is exactly what is stored on the disk. Have a look at the experimental_createPersister, it might do what you need |
Beta Was this translation helpful? Give feedback.
No, with PersistQueryClient, what you have in memory is exactly what is stored on the disk. Have a look at the experimental_createPersister, it might do what you need