Description
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 an expo snack.
The correct behavior is observed in React Native web. However for android/ios the fallback always shows. For the snack I'm using React Native 0.76.7, which is the default version that a new expo project installs. I've also tested on 0.77.1 but get the same behavior.
In my actual project where I have ios/android folders I've tried explicitly setting newArchEnabled/isConcurrentRootEnabled like some of these older articles suggest, see here. However, the same behavior is observed with that as well.
Steps to reproduce
- Go to the expo snack https://snack.expo.dev/@polarwang/reactnative-suspense-usedeferredvalue-bug
React Native Version
0.76.7
Affected Platforms
Other (please specify)
Output of npx @react-native-community/cli info
info Fetching system and libraries information...
System:
OS: macOS 15.2
CPU: (16) arm64 Apple M3 Max
Memory: 3.03 GB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.9.0
path: ~/.nvm/versions/node/v20.9.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v20.9.0/bin/yarn
npm:
version: 10.1.0
path: ~/.nvm/versions/node/v20.9.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12700392
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: javac 22
path: /Library/Java/JavaVirtualMachines/jdk-22.jdk/Contents/Home/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: latest
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.7
wanted: 0.76.7
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.78.0 is now available (your project is running on v0.76.7).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.78.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.76.7&to=0.78.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Stacktrace or Logs
There is no stacktrace but the behavior is illustrated in the snack
Reproducer
https://snack.expo.dev/@polarwang/reactnative-suspense-usedeferredvalue-bug
Screenshots and Videos
No response
Description
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 an expo snack.
The correct behavior is observed in React Native web. However for android/ios the fallback always shows. For the snack I'm using React Native 0.76.7, which is the default version that a new expo project installs. I've also tested on 0.77.1 but get the same behavior.
In my actual project where I have ios/android folders I've tried explicitly setting newArchEnabled/isConcurrentRootEnabled like some of these older articles suggest, see here. However, the same behavior is observed with that as well.
Steps to reproduce
React Native Version
0.76.7
Affected Platforms
Other (please specify)
Output of
npx @react-native-community/cli infoStacktrace or Logs
Reproducer
https://snack.expo.dev/@polarwang/reactnative-suspense-usedeferredvalue-bug
Screenshots and Videos
No response