Description
Describe the bug
I'm following the examples from React on using useDeferredValue
and Suspense
to show a stale state. The correct behavior should be to show the fallback only on the first load, and then on subsequent queries (e.g. when typing in the search box or incrementing counter in the examples) show a stale state until new data is loaded (which then should replace the stale state).
I've included expo snack for React Native and stackblitz for React.
The correct behavior is observed in React (I tested both React 18 + 19) and React Native web. However for React Native android/ios the fallback always shows. For React Native the snack uses React Native 0.77.1. I believe the new architecture is enabled by default, but I have also tried explicitly setting newArchEnabled/isConcurrentRootEnabled like some of these older articles suggest, see here. However, the same behavior is observed.
Your minimal, reproducible example
https://snack.expo.dev/@polarwang/suspense-usedeferredvalue-bug?platform=ios
Steps to reproduce
- Go to this expo snack for React Native android/ios/web example
- Go to this stackblitz for React example
Expected behavior
Described above:
The correct behavior should be to show the fallback only on the first load, and then on subsequent queries (e.g. when typing in the search box or incrementing counter in the examples) show a stale state until new data is loaded (which then should replace the stale state)
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: ios, android
Tanstack Query adapter
react-query
TanStack Query version
v5.68.0
TypeScript version
No response
Additional context
No response