Page freezes when a Suspense boundary suspends again while retrying hydration

Offen
#137 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
react, typescript
Bereich
frontend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.
Vorherrschende Sprache
TypeScript
Sterne
640
Forks
32
Ø Merge
1 Std. 15 Min.
Gemergte PRs (30 T.)
7

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TanStack/redact

Alle Issues in TanStack/redact

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.