-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
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