Page freezes when a Suspense boundary suspends again while retrying hydration

Aperta
#137 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Start by tracing renderSuspense, hydrateSuspenseBoundary, recoverBoundaryHydration, and realHandleSuspended through the retry path described in the issue. Then find the existing hydration and Suspense tests and add coverage for a child suspending during boundary recovery. Done means the pending promise is retried without a repeated microtask loop and the page becomes responsive.

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

Descrizione

Hi! I had a try using Redact and intlayer webapps and the homepage froze on load.

Chrome showed the "Page unresponsive" dialog. With plain React 19 the same build works fine. Changing the feature flags didn't help (redact(), or redact({ features: { ... } })).

After some digging in an unminified build, the console was full of the bare Error() that flushPending throws after 50 passes. It fires over and over, and the microtask loop never gives the main thread back.

What seems to happen:

  1. The landing page sits in a server-rendered <Suspense>. Its content suspends during the first hydration (our dictionaries load lazily), so the boundary gets w set and retryHydration waits on the promise. All good so far.
  2. When it retries (renderSuspense, the state.w && state.b && state.e branch), the markup no longer matches the server, so hydrateSuspenseBoundary falls back to recoverBoundaryHydration. That client-renders with root.h = false.
  3. A child suspends during that client render. suspendHandler isn't set on this path, so realHandleSuspended throws a RenderSuspenseCapture, and the capture doesn't carry the promise.
  4. The catch in that branch only calls retryHydration for thenables, so the capture is rethrown. renderUpdates then reschedules the boundary right away, the child suspends on the same pending promise, and it goes round again.

Versions:
-@tanstack/redact 0.2.5,

  • Vite 8.3.5,
  • @tanstack/react-start 1.169.
Lingua principale
TypeScript
Stelle
640
Fork
32
Merge medio
1h 15m
PR unite (30g)
7

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 TanStack/redact

Tutte le issue di TanStack/redact

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.