Skip to content

Allow resumeAndPrerender to postpone an existing boundary again - #37876

Merged
gnoff merged 2 commits into
react:mainfrom
gnoff:jstory/fizz-resume-prerender-repeated-abort
Oct 19, 2026
Merged

gnoff merged 2 commits into
react:mainfrom
gnoff:jstory/fizz-resume-prerender-repeated-abort

Conversation

@gnoff

@gnoff gnoff commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

resumeAndPrerender fails when the same already emitted Suspense boundary needs to postpone again. This predates #37853: prerendering a suspended boundary, aborting, resuming it while it still suspends, and aborting again hits the missing postponement metadata even when both aborts happen outside rendering.

Initialize tracking for resumed boundaries and preserve the boundary ID already referenced by the emitted HTML. When a pass finishes with postponed holes, flush completed segments as partial output and retain the fallback until a later resume completes the boundary.

Switch the full-flow regression from #37853 from it.failing to it, asserting prerender → resumeAndPrerender → final resume, intermediate HTML, JSON round trips, and removal of placeholders. Add a regression using external aborts to directly cover the existing API bug. Also verify that one resumed boundary can complete while a sibling aborts and postpones again, both at the root and through an already completed Suspense ancestor.

Follow-up to the merged #37853. This PR contains only the resumeAndPrerender fix and its regression tests.

The browser prerender suite passes in development and production on stable and experimental channels. ESLint and Prettier pass.

@meta-cla meta-cla Bot added the CLA Signed label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Comparing: ba39b32...f566173

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 7.35 kB 7.35 kB +0.10% 1.96 kB 1.96 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 626.10 kB 626.10 kB = 110.63 kB 110.63 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 7.36 kB 7.36 kB +0.15% 1.96 kB 1.97 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 697.31 kB 697.31 kB = 122.07 kB 122.07 kB
facebook-www/ReactDOM-prod.classic.js = 715.35 kB 715.35 kB = 125.14 kB 125.14 kB
facebook-www/ReactDOM-prod.modern.js = 705.66 kB 705.66 kB = 123.57 kB 123.57 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-server/cjs/react-server.production.js +0.48% 157.27 kB 158.03 kB +0.35% 27.56 kB 27.65 kB
oss-stable/react-server/cjs/react-server.production.js +0.48% 157.27 kB 158.03 kB +0.35% 27.56 kB 27.65 kB
oss-experimental/react-server/cjs/react-server.production.js +0.46% 161.49 kB 162.24 kB +0.33% 28.37 kB 28.46 kB
oss-stable-semver/react-server/cjs/react-server.development.js +0.26% 224.91 kB 225.50 kB +0.21% 39.28 kB 39.36 kB
oss-stable/react-server/cjs/react-server.development.js +0.26% 224.91 kB 225.50 kB +0.21% 39.28 kB 39.36 kB
oss-experimental/react-server/cjs/react-server.development.js +0.25% 230.47 kB 231.06 kB +0.22% 40.23 kB 40.32 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.25% 260.15 kB 260.80 kB +0.23% 46.77 kB 46.87 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.25% 260.18 kB 260.83 kB +0.23% 46.79 kB 46.90 kB
oss-experimental/react-markup/cjs/react-markup.production.js +0.25% 258.32 kB 258.96 kB +0.22% 47.67 kB 47.78 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.js +0.25% 265.51 kB 266.16 kB +0.20% 48.81 kB 48.91 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.js +0.25% 265.54 kB 266.19 kB +0.20% 48.83 kB 48.93 kB
facebook-www/ReactDOMServer-prod.modern.js +0.24% 267.29 kB 267.93 kB +0.22% 47.65 kB 47.76 kB
facebook-www/ReactDOMServer-prod.classic.js +0.24% 269.68 kB 270.32 kB +0.23% 48.00 kB 48.11 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.24% 270.64 kB 271.28 kB +0.20% 48.29 kB 48.38 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.js +0.23% 276.58 kB 277.22 kB +0.20% 50.51 kB 50.61 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +0.23% 279.54 kB 280.18 kB +0.18% 50.89 kB 50.98 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js +0.23% 288.04 kB 288.69 kB +0.20% 51.31 kB 51.41 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js +0.23% 288.11 kB 288.77 kB +0.20% 51.33 kB 51.44 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.js +0.23% 288.87 kB 289.52 kB +0.20% 51.10 kB 51.20 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.js +0.23% 288.94 kB 289.59 kB +0.20% 51.13 kB 51.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js +0.22% 294.34 kB 294.99 kB +0.18% 53.68 kB 53.77 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js +0.22% 294.42 kB 295.07 kB +0.18% 53.70 kB 53.80 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js +0.22% 302.28 kB 302.93 kB +0.19% 53.51 kB 53.61 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js +0.22% 302.35 kB 303.00 kB +0.18% 53.54 kB 53.64 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.js +0.21% 301.52 kB 302.16 kB +0.20% 53.24 kB 53.35 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.js +0.21% 302.16 kB 302.80 kB +0.21% 53.12 kB 53.23 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.js +0.21% 308.50 kB 309.14 kB +0.18% 55.93 kB 56.03 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.js +0.20% 316.06 kB 316.70 kB +0.21% 55.72 kB 55.84 kB

Generated by sizebot against f566173

@github-actions github-actions Bot added the React Core Team Opened by a member of the React Core Team label Oct 16, 2026
@gnoff
gnoff force-pushed the jstory/fizz-resume-prerender-repeated-abort branch 4 times, most recently from 5327f6b to 656a766 Compare October 16, 2026 18:13
gnoff added a commit that referenced this pull request Oct 19, 2026
#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.
gnoff added 2 commits October 19, 2026 07:58
A second prerender can suspend or abort while filling a hole in an already emitted Suspense boundary. The resumed boundary lacked postponement metadata, and recording it again would replace the ID referenced by the original HTML.

Initialize tracking for resumed boundaries and preserve their existing IDs. Flush completed segments as partial output while postponed holes still block revealing the boundary.

Enable the full synchronous abort and final resume regression from the preceding PR, and cover repeated external aborts on the same boundary. The browser prerender suite passes in development and production on stable and experimental channels, and the Fizz static Node, browser and Node server, and SuspenseList suites pass.
Verify that resumeAndPrerender preserves a completed sibling's output while postponing another boundary again, then completes the remaining boundary on a final resume.

Exercise both root-level replay and replay through an already completed Suspense ancestor so the tests cover boundary ownership across both paths.
@gnoff
gnoff force-pushed the jstory/fizz-resume-prerender-repeated-abort branch from 656a766 to f566173 Compare October 19, 2026 14:58
github-actions Bot pushed a commit that referenced this pull request Oct 19, 2026
#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.

DiffTrain build for [ba39b32](ba39b32)
@gnoff
gnoff merged commit e92156b into react:main Oct 19, 2026
239 checks passed
@gnoff
gnoff deleted the jstory/fizz-resume-prerender-repeated-abort branch October 19, 2026 17:02
github-actions Bot pushed a commit that referenced this pull request Oct 19, 2026
`resumeAndPrerender` fails when the same already emitted Suspense
boundary needs to postpone again. This predates #37853: prerendering a
suspended boundary, aborting, resuming it while it still suspends, and
aborting again hits the missing postponement metadata even when both
aborts happen outside rendering.

Initialize tracking for resumed boundaries and preserve the boundary ID
already referenced by the emitted HTML. When a pass finishes with
postponed holes, flush completed segments as partial output and retain
the fallback until a later resume completes the boundary.

Switch the full-flow regression from #37853 from `it.failing` to `it`,
asserting prerender → resumeAndPrerender → final resume, intermediate
HTML, JSON round trips, and removal of placeholders. Add a regression
using external aborts to directly cover the existing API bug. Also
verify that one resumed boundary can complete while a sibling aborts and
postpones again, both at the root and through an already completed
Suspense ancestor.

Follow-up to the merged #37853. This PR contains only the
resumeAndPrerender fix and its regression tests.

The browser prerender suite passes in development and production on
stable and experimental channels. ESLint and Prettier pass.

DiffTrain build for [e92156b](e92156b)
eps1lon pushed a commit to vercel/next.js that referenced this pull request Oct 20, 2026
[diff
react/react@ba39b32a...a6792708](react/react@ba39b32...a679270)

<details>
<summary>React upstream changes</summary>

- react/react#37901
- react/react#37876

</details>

---------

Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants