Skip to content

Commit ba39b32

Browse files
authored
Preserve the rendered shell on synchronous prerender abort (#37853)
#37709 showed that a synchronous prerender abort can discard a retried task's rendered shell, then resume only an inner slot. #37710 addressed the missing markup by postponing the whole task, but that could overlap replay paths from child tasks; #37852 reverted that approach. Preserve the parent segment and continue rendering its text and host elements after abort. When a component or other render callback returns after abort, discard its children and track a postponed hole at that node. This includes function and class components, lazy and forward-ref components, Context.Consumer render props, iterables, and thenables. Already-created arrays are read normally; getters and host prop serialization follow React's render-purity rules. SuspenseList rows use the same postponement path and existing row task bookkeeping. Preserve individual holes only while rendering an unfinished Suspense boundary. Tasks without a blocked boundary unwind through the existing root abort path: a postponed root cannot flush any shell and must render again in full. Tests cover root aborts during the initial render, in a retried child, and during a subsequent resumeAndPrerender, followed by a complete final resume. This restores the tests from #37710, #37850, and #37851 and adds coverage for indexed retries, static host children after abort, iterators and thenables, forward refs, render-phase updates, nested fallbacks, and SuspenseList rows. A full-flow regression for repeated aborts during resumeAndPrerender is marked `it.failing`: it exposes an existing bug in postponing an already emitted boundary, fixed separately in #37876. The browser prerender suite passes in development and production on stable and experimental channels, including the expected failure. ESLint and Prettier pass.
1 parent 63d39af commit ba39b32

2 files changed

Lines changed: 1245 additions & 3 deletions

File tree

0 commit comments

Comments
 (0)