Skip to content

resumePausedMutations are not running after switching from offline to online after version 4.24.3 up to 4.32.6(latest) #5847

@timabilov

Description

@timabilov

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

  1. Go to any movie
  2. Go offline/ turn off your wife
  3. Add comment (to verify, add it three times)
  4. Refresh the page
  5. ENABLE your WIFI and then wait
  6. Nothing happens, but expected this mutations to get unpaused
  7. Refresh the page and you see updates are applied now sequentially.

This happens in my React Native setup too.

  1. Go offline
  2. Add todo (fire any mutation which will be paused)
  3. Exit from app then enter again (both RN debug/release mode)
  4. enable internet
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions