Skip to content

Stucked in "Paused" mode after getting into Offline state #4772

@wilq32-hub

Description

@wilq32-hub

Describe the bug

Bug is bit weird:

We do use TanStack in React in most recent version in our application and it works fine, but today I have second bug request from user saying no fetch/XHR request being made at all. I did longer session with him to realise that all normal queries instead of normal state are immediately end up in "Paused" state. As this user is currently in Ukraine i did some assumption that it might be related to Offline case and power shortages which leads me to this page:

https://stackoverflow.com/questions/73444102/react-query-cancel-abort-mutation-if-paused-offline

Which is not exactly what I look for but found out that setting

networkMode: 'always',

does fix the problem for the user.

My assumption is that the "Offline" state is somewhat stored by TanStack and not being reset i.e. next time a page reloads properly (sic). I asked him to manually disconnect from internet and connect to it again when having our web page opened and it helped for his case. This would lead me to think that this "Offline" state is somewhat preserved between next usages of page and does not reset properly. I will try to look at the TanStack code where exactly this problem is, but I think for now it would be great that whenever user reload page - there should be at least check if Offline was set before and disable that state.

Your minimal, reproducible example

Unfortunately no reproduction, check description

Steps to reproduce

I could not reproduce this issue on my machine, and I had to debug it trough Slack share screen. But I do assume that it might happen when user lose connection (gets into offline case) and then tab/browser is closed (or computer crashes?).

Expected behavior

As an user I expect to have request correctly working in Online mode. When this bug shows up, until browser emit connectionStatusChange it will not send any requests.

How often does this bug happen?

Sometimes

Screenshots or Videos

No response

Platform

Platform independent
react.18.2

TanStack Query version

4.20.9, react-query,

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions