-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
8991d7c this is the commit where it breaks (4.24.3)
Not sure if this is correct behaviour. But based on the commit above i assume it is a bug indeed.
Paused mutations get stuck when rehydrating(loading) mutations in offline mode and switching back online.
Basically, when you reenter the exited app in offline mode it restores the mutations successfully, i see paused mutations in logs as a result of resumePausedMutations.
But when you get back online, paused mutations do not run. This happens in latest 4.32.6. When i reload(React Native) my javascript it runs again.
But, i got to the version where it works and triaged this.
basically this is the commit where it starts breaking
8991d7c
Shortly, 4.24.3 and upper version causes this bug
Your minimal, reproducible example
Run https://github.com/TanStack/query/tree/main/examples/react/offline
Steps to reproduce
- Go to any movie
- Go offline/ turn off your wife
- Add comment (to verify, add it three times)
- Refresh the page
- ENABLE your WIFI and then wait
- Nothing happens, but expected this mutations to get unpaused
- Refresh the page and you see updates are applied now sequentially.
This happens in my React Native setup too.
- Go offline
- Add todo (fire any mutation which will be paused)
- Exit from app then enter again (both RN debug/release mode)
- enable internet
- At the end i see 1 paused mutation pending in my logs.
So it stucks/waits here:
queryClient.resumePausedMutations()
Expected behavior
As a user, i am expecting all mutations to start running after resume, but no mutations are running in that case.
In logs they are all paused
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
React Native 0.70.6
Tanstack Query adapter
react-query
TanStack Query version
4.32.6 (but started in 4.24.3!!)
TypeScript version
No response
Additional context
If i will reload my javascript after 5th step, then it resumes mutations again and runs them correctly
Also, if you have internet enabled before entering the app, it works as expected.