Skip to content

Disabled Suspense Query suspended when same child suspense Query is called #6494

@Kanary159357

Description

@Kanary159357

Describe the bug

Enabled=false Suspense Query trigger Suspense when other enabled=true Suspense Query is called

Your minimal, reproducible example

https://codesandbox.io/p/devbox/cool-matsumoto-xdd457?file=%2Fsrc%2FApp.tsx%3A15%2C27

Steps to reproduce

Wrap parent component with suspense, add enabled=false suspense=true Query to Parent Component.
Wrap child componetn with suspense, add same query with parent but enabled option is false to Child Component.

When this component(including parent component and child component) render, it shows Parent Component's Suspense

Expected behavior

I think disabled query should not throw promise to Suspense.

So I think in suspense.ts, shouldSuspend function should include option's enabled property in order not to suspense on disabled query

Or is current behaviour intended?

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

MacOS Sonoma 14.0 M1 Max 32GB
Chrome 119.0.6045.159 arm64

Tanstack Query adapter

react-query

TanStack Query version

4.36.1

TypeScript version

5.3.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions