-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
I'm not sure if this is an issue with @tanstack/query-async-storage-persister
package or the @tanstack/react-query-persist-client
package. I have implemented the base setup for async storage persister in a react native app with PersistQueryClientProvider as the provider instead of the imperative approach.
If the app is loading data from an API endpoint and the user force closes the app, the persisted data is left in a broken state. This will most likely cause the app to crash on next cold start. My understanding is that this is because the data saved may be a pending promise in some cases. In my case I expected some data to be a string but got: {"_h": 0, "_i": 0, "_j": null, "_k": null}
Another issue may be that some data may be partially defined and partially undefined.
Your minimal, reproducible example
https://snack.expo.dev/@justinmathew/tanstack-async-persistence
Steps to reproduce
Force close the app while data is fetching
Expected behavior
The app shouldn't crash on cold start after failed data fetch
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
- OS: [Android, iOS]
Tanstack Query adapter
None
TanStack Query version
5.76.1
TypeScript version
No response
Additional context
No response