Skip to content
Source
Sign inSign up
TanStack/query

failed queries won't continue retries when unmounting and remounting while waiting for the retry #3031

Send to my agent
ClosedTkDodo opened this issue 1 comment
TkDodocommented

Describe the bug

Encountered while seeing strict effects being enabled, which might mount and unmount multiple times. The situation is:

  • component mounts, we fetch
  • fetch errors, we wait for retry (set retryDelay to a high time)
  • now, component unmounts and remounts
  • this "cancels" the retry, but the component stays in fetching state

--> once the retrier continues, it sees that the retry has been cancelled and just returns the error, but in fact, it should continue to retry because a new observer has mounted.

Potential solution is to expose a continueRetry method, which will undo the cancelRetry (its just a flag that is set to true) so that the retrier can continue. We can invoke this when we try to fetch but are already in fetching state and thus just return the current promise.

  1. TkDodo added labelsbug

  2. TkDodo closed this

  3. :tada: This issue has been resolved in version 3.33.7 :tada:

    The release is available on:

    Your semantic-release bot :package::rocket:

  4. tannerlinsley added labelsreleased

Sign in to join this conversation.