T
TanStack4y ago
other-emerald

react-query v4 async storage persister cache time

In createAsyncStoragePersister which parameter determines how long react-query will not fetch while it is cached? staleTime: Infinity, cacheTime: 60000, With these settings I imagined that the Async Storage Persister cache would be ignored after 1 minute. But even after 1 min it doesn't call backend
2 Replies
other-emerald
other-emeraldOP4y ago
I found "maxAge" in "persistOptions" in "PersistQueryClientProvider". But I would like to set an age for each query, is this possible?
eastern-cyan
eastern-cyan4y ago
you're misunderstanding the persisters. They have nothing to do with determining when data will be fetched / not fetched. what they do is take the cache and store it on a persistent device, so that you can pick up where you left off when you re-open the page

Did you find this page helpful?