Skip to content

QueryErrorResetBoundary not reset after throwing error in component with useSuspenseQuery #7465

@visualjerk

Description

@visualjerk

Describe the bug

When throwing an error from a useSuspenseQuery like described here resetting the QueryErrorResetBoundary does not reset the error in useSuspenseQuery.

This happens when the error occurs on a subsequent fetch. It works as expected, if the error occurs while fetching data initially.

Your minimal, reproducible example

https://stackblitz.com/edit/github-vmd3m2?file=src%2Fcomponents%2FProjects.jsx

Steps to reproduce

  1. Click on "Show Projects"
  2. Click on "Refresh"
  3. Click on "Try again"
  4. The ErrorBoundary fallback is still shown

Expected behavior

After 3. the Suspense fallback should be shown and after a short while the project list should be shown.

How often does this bug happen?

Everytime

Screenshots or Videos

query-suspense-error-handling.mov

No response

Platform

  • OS: MacOS 14.4.1
  • Browser: Chrome 124.0.6367.209

Tanstack Query adapter

react-query

TanStack Query version

5.37.1

TypeScript version

No response

Additional context

No response

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