TanStackT
TanStack4mo ago
19 replies
skinny-azure

Offline persistent mechanism for the error state

I am using TanStack in a React Native environment and trying to provide a smooth offline/low connection experience for users.
I use PersistQueryClientProvider with AsyncStorage, and offline mode generally works well. However, I expected mutations to persist during error retries, even if a mutation fails mid-process. This is important for users with low connectivity—we don’t want to lose their data if a mutation fails and the user closes the app.

The use case that I am trying to solve is:
If a user with a poor internet connection triggers a mutation, the request might take too long and eventually throw a timeout error. The system will retry the mutation several times based on the query client configuration. However, if the user closes the app during these retries, the mutation is lost—whereas the expectation is that the mutation operation would resume once the app is reopened.

Is it possible to persist mutations after errors, similar to how queries are persisted?
Was this page helpful?