Skip to content
Source
Sign inSign up
TanStack/query

Refetching query doesnt set error back to null #3090

Send to my agent
ClosedTosheen(GitHub profile, opens in a new tab) opened this issue 4 comments

Describe the bug

When query refetching happens, for example on window focus, error object is not cleared even though types say that when isLoading is set to true, error is always null. Screenshot attached

Your Example Website or App

https://codesandbox.io/s/boring-paper-l7jf0?file=/src/use-subscription.tsx

Steps to reproduce

Open the console and watch for variables being displayed, once you refocus back to the window both isLoading and error are displayed.

Expected behavior

  • remove the error when we go to loading state.
  • change the types so that they reflect that you can have an error in loading state, too.

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

  • OS: [e.g. macOS, Windows, Linux, iOS, Android]
  • Browser: [e.g. Chrome, Safari, Firefox, React Native]
  • Version: [e.g. 91.1]

Additional context

No response

  1. TkDodo added labelsbug

  2. TkDodo closed this

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

    The release is available on:

    Your semantic-release bot :package::rocket:

  4. tannerlinsley added labelsreleased

  5. :tada: This issue has been resolved in version 4.0.0-alpha.6 :tada:

    The release is available on:

    Your semantic-release bot :package::rocket:

  6. tannerlinsley added labelsreleased on @alpha

  7. What if i want the error to stay until the data is not coming, on successive refetch the error should stay, is there's any option i can use to achieve that? @TkDodo might help.

  8. don't think so

Sign in to join this conversation.