Page freezes when a Suspense boundary suspends again while retrying hydration

Aberta
#137 6 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
react, typescript
Domínio
frontend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
TypeScript
Estrelas
640
Forks
32
Merge médio
1h 15min
PRs com merge (30d)
7

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/redact

Todas as issues de TanStack/redact

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.