T
TanStack3y ago
rising-crimson

Update Persister with New Data

Hey! My async storage has the option to notify me when the storage is updated from elsewhere (different tab for example). I was looking at the docs and I think I found this: https://tanstack.com/query/v4/docs/react/plugins/persistQueryClient#persisters but I'm not sure what exactly restoreClient does. Should I call that any time that my storage notifies me the local storage changed? The notification also includes the new data, can I just somehow pass that to react-query to save an extra read? Either way works
persistQueryClient | TanStack Query 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. Build Persisters
1 Reply
ratty-blush
ratty-blush3y ago
You can restore which reads again, or just call queryClient.setQueryData with the data you already got (assuming you know which key it belongs to)

Did you find this page helpful?