Skip to content

fix(octane): observe async component SSR replays - #506

Merged
leonidaz merged 4 commits into
octanejs:mainfrom
jonkwheeler:jon/ssr-async-component-replay
Aug 3, 2026
Merged

leonidaz merged 4 commits into
octanejs:mainfrom
jonkwheeler:jon/ssr-async-component-replay

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • observe fresh thenables recreated when SSR replay consumes a cached async-component outcome
  • preserve the cached result or rejection as authoritative, including hostile synchronous thenables
  • cover fulfilled, rejected, @try, repeated, concurrent, and mixed async-component replays in development and production

Why

Buffered SSR discovery re-invokes plain async components. When use() found the earlier string-keyed result, it returned or threw before observing the newly created Promise. Fresh rejected replay Promises therefore escaped as duplicate unhandledRejection events even though the authored @catch rendered the error.

Verification

  • focused SSR suspense projects: 36 tests passed
  • all SSR glob plus streaming SSR, development and production: 38 files / 468 tests passed
  • scoped runtime server typecheck passed
  • scoped formatting, pnpm sync, and diff checks passed
  • independent correctness review found no actionable code findings; adversarial thenable and concurrent rejection gaps were added afterward

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Touches core server use()/suspense replay and settlement paths used on every SSR render; behavior is narrowly scoped but correctness-sensitive for async boundaries and hydration seeds.

Overview
Fixes SSR replay for plain async components that return a new Promise on each re-invocation: when use() reads a cached string-key outcome, it still subscribes to the replacement thenable with a no-op handler so late rejections do not become duplicate unhandledRejection events, while the first-pass settled value or reason stays authoritative and @catch still renders.

Suspense settlement now stores the originating thenable on each cached outcome (string-key map entries and parallel-use paths), enabling that identity check without re-observing the same thenable on every replay.

Reviewed by Cursor Bugbot for commit 17c7a9c. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Aug 3, 2026 3:43am
octane-website-mcp Ready Ready Preview Aug 3, 2026 3:43am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 2, 2026 20:05 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 2, 2026 20:05 Inactive
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 2, 2026
@leonidaz
leonidaz marked this pull request as draft August 2, 2026 22:28
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 03:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 03:15 Inactive
@leonidaz
leonidaz marked this pull request as ready for review August 3, 2026 03:42
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 03:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 03:43 Inactive
@jonkwheeler
jonkwheeler marked this pull request as draft August 3, 2026 03:51
@leonidaz
leonidaz marked this pull request as ready for review August 3, 2026 03:51
@leonidaz
leonidaz merged commit f9b2731 into octanejs:main Aug 3, 2026
91 checks passed
@jonkwheeler
jonkwheeler deleted the jon/ssr-async-component-replay branch October 20, 2026 12:53

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 17c7a9ce Deployed Aug 3, 2026 by vercel[bot]
Preview – octane-website-mcp — 17c7a9ce Deployed Aug 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants