Skip to content
Discussion options

You must be logged in to vote

given that you are using networkMode, I assume you are on v4. The default networkMode of 'online' should do what you want here. It expects you to be online to trigger a query, and if not, the query will go into paused state while still giving you data from the cache.

but a fetch is happening in the network tab and as a result the next time I close the app and reopen it we have no cache on the query.

that seems a bit weird to me. Once you have data in the cache, we don't remove it. Maybe the query transitions to an error state and persistQueryClient doesn't include erroneous queries, as per default only successful queries are included:

https://github.com/tannerlinsley/react-query/blob/19…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Manouli
Comment options

@Manouli
Comment options

@TkDodo
Comment options

Answer selected by Manouli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants