Skip to content

Query errors not being reset #3485

@joshribakoff-sm

Description

@joshribakoff-sm

Describe the bug

Similar to past issues #468

Once there is an error, react-query seems to cache the error. Even when I reset the error boundary, causing my component to re-mount, it serves the error without even re-attempting the network request (counter intuitive).

After adding useQueryErrorResetBoundary(), it has no effect when using it as documented with <ErrorBoundary onReset={reset} />

In my minimal repro, you can see it's broken. The only workaround I have found is to call reset() in my onClick, but in my real app there is no button to reset the error boundary, the resetKeys just reset it when the URL changes. If my user navigates away and navigates back, I'd expect the query to be retried, but it is not.

Your minimal, reproducible example

https://github.com/joshribakoff-sm/rq-bug/blob/reset/src/App.js

Steps to reproduce

Clone my repro, wait for it to error then hit the button to reset

Expected behavior

reset the error

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Mac
Chrome

react-query version

3.34.16

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