Repository navigation
fix(octane): adopt the server catch arm when a template-less use() reader rejected - #1523
Merged
Merged
Conversation
…ader rejected A template-less component (lowered to componentSlot) whose use() rejected on the server has no server range: the boundary that caught the rejection rendered its @catch arm in that place. The missing-range claim discarded that arm, reported a hydration mismatch, and minted fresh markers before the body ran. The fresh range suspended hydration for the whole body, so use() never read the rejection seed and the root stayed suspended. The claim now only records the server node and mints the markers. HydrationCapability.renderUnframed renders the body without adopting anything while it still consumes positional seeds. A seeded rejection removes only the fresh markers, so the boundary adopts the server catch arm. Any other outcome reports the mismatch and discards the server nodes as before. Catch arms unwrap a hydration rejection through the current hydration, so a boundary inside that replay sees the decoded reason. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Benchmark report
Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)
30 other measured values are unchanged. Public-import reachability bundles (bytes)
72 other measured values are unchanged. CI job durations
Compares the CI run for
All 26 timed jobs
|
trueadm
marked this pull request as ready for review
October 1, 2026 23:34
…n-f00dc7 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hydrating a
@trywhose body is a template-less component (no@{}, lowered tocomponentSlot) thatuse()s a promise the server rejected lost the server's@catcharm:compmarkers where<p class="caught">was;onCaughtErrornever fired;onRecoverableErrorreported error 55, and dev logged "expected a component range but the server rendered<p>";A template reader (
componentSlotLite) in the same position already adopted the server's<p>and reported the caught error. This PR makes the template-less path match it.Root cause. When the server range was missing,
componentSlotImplacted before the body ran: it reported 55, removed the server nodes (the catch arm), and inserted fresh markers.renderBlockswitches hydration off for a dynamic block with a fresh end marker, souse()never read the rejection seed and suspended instead of throwing the rejection the boundary adopts.Fix (
packages/octane/src/runtime.ts):HydrationCapability.renderUnframedrenders the body.use()calls still consume positional seeds, as the server's render did (replayDepth,consumesSeeds(), andseedHydration()at the three seed-read sites:useThenable,seedOrCreate,useBatch).mountTry/errorBlockadopt the untouched server catch arm.switchToCatchInnerandswitchErrorToCatchInnerunwrap a hydration rejection throughcurrentHydration. A@catcharm or<ErrorBoundary>inside that client-built subtree therefore receives the decoded reason, not the internal wrapper.Validation
pnpm format:check: not run repo-wide;pnpm format:files:checkon every changed file passespnpm typecheck: not run repo-wide;pnpm typecheck:fileson every changed file passespnpm test: not run in full; theoctaneandoctane-prodvitest projects pass in full (see below)packages/octane/tests/hydration/try-templateless-reader.test.tsinoctaneandoctane-prodNew regression suite, 9 tests per project:
@pendingarm;@catchand a nested<ErrorBoundary>getting the decoded reason;Without the fix, 5 of the 8 tests that existed then fail in both projects; the 3 controls pass. Breaking each part of the fix separately also turns a test red:
inner:[object Object];Full vitest projects on the rebased head:
octane19,582 passed (683 files) andoctane-prod16,141 passed (608 files).pnpm syncleaves the tree clean.Bundle size (
benchmarks/bundle-size/run-minimal.mjs, base vs candidate, gzip):root-static−482,context−176,suspense-transition−167, base-ui/radix/apollo −495 to −531;hydrate-root+171,deferred-hydration+79.Risk / follow-ups
Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core hydration,
use()seeding, and@try/@catchadoption paths; genuine server/client shape mismatches now consume seeds before reporting, which can affect ordering of recoverable errors.Overview
Fixes hydration when a template-less component’s
use()rejected on the server and the boundary rendered@catchwhere the client expected a component range. Previously the slot claim removed the server catch DOM and reported error 55 before the body ran, souse()never consumed the rejection seed, the tree stayed suspended, andonCaughtErrordid not fire.The claim now defers cleanup and runs the body via
HydrationCapability.renderUnframed, whileseedHydration()/replayDepthlet that pass still consume positional seeds (including the rejection) even when it adopts no server nodes. On a seeded rejection, only fresh markers are dropped and the server catch arm is adopted; other outcomes still report the mismatch after the body. Catch / error-boundary paths unwrap hydration rejections viacurrentHydrationso nested handlers get the decoded reason.Adds a hydration regression suite (
try-templateless-reader) covering adoption, seed alignment, nested rethrows, resolved readers, and genuine branch mismatches.Reviewed by Cursor Bugbot for commit 61279b2. Bugbot is set up for automated code reviews on this repo. Configure here.