Using useDeferredValue and Suspense unexpectedly shows fallback in ios/android but correctly shows stale state in web
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 4
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza con el reproducer de Expo Snack enlazado y compara su comportamiento de React Native en iOS/Android con React Native web. Comprueba el flujo del ejemplo de useDeferredValue y Suspense descrito en el issue y verifica después que la versión nativa solo muestra el fallback durante la primera carga y contenido obsoleto durante las consultas posteriores.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- react-native
- Área
- mobile
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100