Dev mode cache logic question
When running dev, I have to re-fetch all of my collections each time i refresh the page. I'm sure I'm ignorant here, but shouldn't it persist the data across refreshes and update it being local first? Or is this by design in dev mode?
3 Replies
fascinating-indigo•2mo ago
are you talking about tanstack db in this case?
both query and db stores the cache in memory by default. and refreshes clean the memory
if you want to persist data across refreshes, you need to set up persister separately
https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient
persistQueryClient | TanStack Query React Docs
This is set of utilities for interacting with "persisters" which save your queryClient for later use. Different persisters can be used to store your client and cache to many different storage layers....
sensitive-blueOP•2mo ago
Thanks for the assist, @hokkyss. So then if I want this to be a field app that will be primarily used offline, then I need to set up a persister like this to ensure it's still there when refreshing, correct?
like-gold•2mo ago
when i am using persistentQueryClientWrapper it is giving 500 error