React 19.2: a frozen boundary is re-rendered and re-committed in a loop (retry lanes rotate forever), starving timers and network callbacks

Aperta
#44 1 commento 1 reazione 0 assegnatari Vedi su GitHub

@JacquesLeupin ci sta già lavorando.

Dal 17/11/2026.

  • #46 di @JacquesLeupin — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, react-native
Ambito
frontend

Direzione di ricerca

Start with the Freeze component's handling of its infinite thenable, then the React 19.2 retry-lane path in node_modules/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js (scheduleRetryEffect, claimNextRetryLane, getNextLanes). Reproduce by checking root.pendingLanes and root.suspendedLanes in a <Freeze freeze> subtree after a parent re-render. Done means the commit loop stops on React 19.2 and a maintainer has chosen between Activity-based hiding and a Freeze change; that choice is design work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

On React 19.2 (sibling prerendering enabled), a <Freeze freeze> boundary that has committed its fallback is re-rendered and re-committed by React in a tight loop: the never-resolving thenable makes React claim a new retry lane on every commit, and getNextLanes immediately prerenders that lane again because it is suspended but never "warm". In a React Native app this saturates the JS thread (~400 commits/s measured) and starves everything that goes through the RN scheduler queue: timers, network callbacks, Fast Refresh. Touch events still arrive, so the app looks alive but nothing updates until the next tap.

We hit this through react-native-screens' freezeOnBlur on @react-navigation/bottom-tabs (every blurred tab is a permanently frozen subtree). Disabling freeze resolves it.

Environment

  • react-freeze 1.0.4
  • react 19.2.3, react-native 0.86.3 (bridgeless / Fabric), Hermes
  • react-native-screens 4.26.2 (DelayedFreeze → Freeze), @react-navigation/bottom-tabs 6.6.1 with freezeOnBlur: true
  • Measured in Expo Go (SDK 57); the original report in our app came from a development build on device

Observations (measured in the running app via the Hermes CDP debugger and CPU profiler)

  • root.pendingLanes rotates through the retry lanes on successive reads: RetryLane3|4 → RetryLane2|3 → RetryLane1|2 → RetryLane3|4 …; suspendedLanes is always the previous retry lane; root.callbackNode is a new task each time.
  • The only fibers holding those lanes are the <Suspense> boundaries rendered by Freeze, all in fallback state (memoizedState !== null).
  • Hermes CPU profile over 6 s: JS thread saturated, completeRoot (Fabric commit host function) is the top self-time entry, 2,578 React commits in the window. Call tree: performWorkOnRootViaSchedulerTask → performWorkOnRoot → renderRootConcurrent → commitRootWhenReady → commitRoot.
  • A 30 ms setInterval at app root got 0 ticks in 342 s; a setTimeout(fn, 0) fired after ~50 s; setImmediate and microtasks ran instantly; a DefaultLane setState committed within ~100 ms but did not stop the loop.
  • Any discrete input event (a tab tap, even on the selected tab) commits a SyncLane render and the loop stops, until the next render that reaches the frozen boundary (tab switch, parent re-render) restarts it.

Mechanism (react-native 0.86.3's ReactFabric-dev.js, React 19.2.3)

  1. Suspender throws infiniteThenable = { then() {} }. The boundary commits in fallback.
  2. Whenever that boundary completes while already in fallback, scheduleRetryEffect calls claimNextRetryLane() and adds the lane to workInProgressSuspendedRetryLanes.
  3. markRootFinished puts the lane in root.suspendedLanes but not root.warmLanes.
  4. getNextLanes: no unblocked lanes, no pinged lanes, so the sibling-prerendering branch picks nonIdlePendingLanes & ~warmLanes and renders it.
  5. That render hits Suspender again, but because the boundary was already showing the fallback it does not take the renderDidSuspend exit; the render completes, commits, and step 2 repeats. warmLanes is never set.

React 18 / 19.0 never scheduled a retry without a ping, so the infinite thenable was inert there. With sibling prerendering (19.1+), React assumes a suspended boundary will eventually ping, which is exactly the assumption Freeze breaks.

Reproduction

Any <Freeze freeze> subtree on React 19.2 should do it once a parent re-render reaches the boundary after the fallback has committed. The cleanest observation is __REACT_DEVTOOLS_GLOBAL_HOOK__.getFiberRoots(1) → root.pendingLanes / root.suspendedLanes rotating through 4194304 | 8388608 | 16777216 | 33554432 while no state changes, and a setInterval at the root that stops firing. I have not reduced it to a standalone repo yet; happy to if useful.

Possible directions

  • React 19.2 ships <Activity mode="hidden">, which is the non-Suspense way to get the same "keep state, stop rendering" behaviour and does not depend on a thenable that never resolves.
  • Short of that, a then that at least records the ping callbacks and a Freeze that calls them on unfreeze would still not stop the prerender loop, since the loop happens while frozen; so a React-side issue may also be warranted. Filing here first because the assumption that a suspended boundary never pings is Freeze's design.

Related

  • software-mansion/react-native-screens#2971 (JS FPS dropping to 20-40 with freezeOnBlur on bottom tabs, RN 0.79) looks like the same loop seen from the outside.
Lingua principale
TypeScript
Stelle
1.7k
Fork
45
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di software-mansion/react-freeze

Tutte le issue di software-mansion/react-freeze

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.