Page freezes when a Suspense boundary suspends again while retrying hydration

未關閉
#137 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
react, typescript
領域
frontend

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
TypeScript
星號
640
分支
32
平均合併
1 小時 15 分鐘
30 天內合併 PR
7

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/redact 的其他 Issue

查看 TanStack/redact 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。