Repository navigation
fix(octane): handle hydration mismatches like React 19 (boundary/root client-render fallback) - #1784
Conversation
…ing per site Adds the plan for matching React 19's hydration fallback and the first mechanism step: a HydrationMismatch control error (code 339, React's message) that the Suspense, Hydrate and root owners already handle by discarding the server DOM and rendering on the client. adopt's repair branches now throw, and the dev-only static attribute/markup compare warns instead of deciding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An @if/@switch slot, a list, or a component call that finds what the server rendered for another arm no longer frames, rebuilds, holds or discards it in place. A missing branch or list range, a nested arm pair that does not span its slot, unclaimed content left at an arm's tail, a server arm where the client renders an empty one, a list whose server arm differs (items vs @empty), fewer or more server items, and a component hole whose walk found an element instead of its range all throw HydrationMismatch, so the nearest Suspense arm, Hydrate island or the root renders on the client. Deletes the recovery machinery that became unreachable: markerless and held hydrating branches (markerlessCursor, renderMarkerless, holdMarkerlessBranch, heldBranchEnd and the list holds), rebuilt roots and fragments (insertRoot's replacement path, resumeAt, replaces, sweepRebuiltTail, rebuildFragment, placeRebuilt), the per-site list discards (discardItems, discardListArm, discardLeftoverItems, reportRebuiltRange) and retired error code 56. Keeps what matching content still needs: holeOpen's framing (a returned Activity's children hydrate through it), and in-place adoption of a frameless call below a passthrough root, whose owner shifts the server ranges one level. A dormant island whose captures changed falls back without reporting, and a Suspense arm that falls back publishes its held diagnostics. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Presentation misses skip retry conversion
- Added the
presentationMiss()guard inside the sharedmismatch()method so that all structural mismatch paths—includingslotMismatch,branchOpen, and adopt's fragment-remainder arms—throwPresentationAdoptionMissinstead ofHydrationMismatchduring presentation hydration, enabling retry.
- Added the
Or push these changes by commenting:
@cursor push ea5052387a
Preview (ea5052387a)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -20210,6 +20210,7 @@
* renders on the client (see HydrationMismatch), as React does.
*/
mismatch(loc: string | undefined, expected: () => string, actual: Node | null): never {
+ if (PRESENTATION_HYDRATION?.revision !== undefined) presentationMiss();
if (process.env.NODE_ENV !== 'production')
warnHydrationStructuralMismatch(
loc ?? componentSourceLoc(CURRENT_BLOCK?.body) ?? CURRENT_SCOPE?.locFile,You can send follow-ups to the cloud agent here.
… tails and root shapes A component call without its server range, server content left after a component's or a list's content, an unadoptable value in an adopted or lent range, server text where a renderable or only-child hole renders an element, component or list, a runtime host whose server node differs, an unframed root shape that is not plain text or null, and an island's unclaimed remainder all throw HydrationMismatch now, so the nearest Suspense arm, Hydrate island or the root renders on the client instead of repairing the site. A root keeps unmatched siblings left in its container, as React does: hydrateRoot no longer sweeps or reports its remainder. A root's fallback publishes the mismatch's dev warning, which its never-committed attempt would otherwise drop. Deletes the recovery machinery that became unreachable: unframed replays and their suspended claims, in-place discards and lent ranges (lend, claimLent, settleLent), the rebuilt-range and rebuilt-host records (HYDRATION_REBUILT, HYDRATION_REBUILT_HOSTS, remember, firstAtRangeEnd), discard, reclaimOwnedHost, abandonRoot and the abandoned state, reportStructural, and retires error codes 51, 52, 53 and 55. Keeps what matching content still needs: in-place adoption of a call whose body matches the server node it stands at (renderInPlace, renderUnframed's framing), tail detection for adopted ranges (claims, settleClaim), the quiet build of items that render nothing into an empty range, and the returned-component range borrow that lets a component adopt server text it returns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Unframed suspend loses resume mode
- Restored suspend handling in renderUnframed (saves unframed context to unframedSuspends WeakMap), renderSuspended (parent-walk raises replayDepth for unframed retries), and componentSlot/componentSlotLite warm paths (re-enter renderUnframed on retry).
- ✅ Fixed: Unframed rejection keeps fresh markers
- Added rejection detection in renderUnframed's catch block that removes the fresh start/end markers via removeRange(start, getNextSibling(end)) so the boundary's catch arm finds the server's catch content intact.
Or push these changes by commenting:
@cursor push 896042fb92
Preview (896042fb92)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -11997,6 +11997,22 @@
);
return;
}
+ } else if (hydration !== null) {
+ const uf = hydration.unframedSuspend(scope.block as Block);
+ if (uf !== undefined) {
+ hydration.renderUnframed(
+ () => componentSlotLite(parentScope, slotKey, host, comp, props, invocationSite),
+ undefined,
+ scope.block.endMarker!,
+ uf[0],
+ uf[1],
+ uf[2],
+ scope.block as Block,
+ uf[3],
+ );
+ hydration.node = getNextSibling(scope.block.endMarker!);
+ return;
+ }
}
const prevScope = CURRENT_SCOPE;
const warmPlanCheckpoint = ACTIVE_WARM_PLANS.length;
@@ -12088,6 +12104,8 @@
root ?? null,
parentScope,
slotKey,
+ (parentScope.slots[slotKey] as Scope).block as Block,
+ start,
);
hydration.node = getNextSibling(end);
}
@@ -19229,6 +19247,9 @@
private readonly unframedRootRanges = new WeakMap<Node, Node>();
/** Adopted ranges whose first render suspended, by block, with its slot (renderClaimed). */
private suspendedClaims: WeakMap<Block, readonly [Scope, number]> | null = null;
+ /** Unframed renders that suspended, by owner block (renderUnframed). */
+ private unframedSuspends: WeakMap<Block, readonly [Node | null, Scope, number, Node]> | null =
+ null;
/** The server node renderInPlace's body may adopt, until a template does. */
private inPlace: Node | null = null;
/** Whether inPlace stands after the fresh markers of renderUnframed's call. */
@@ -19528,7 +19549,10 @@
* roots match, and `end` then moves past them, framing them as the server's
* range would have. A body that adopts nothing there does not match what
* the server rendered. In a client-built region (`root` null), the body
- * adopts nothing but still consumes its positional seeds.
+ * adopts nothing but still consumes its positional seeds. A suspension
+ * leaves the server nodes in place and saves the context for a retry
+ * (unframedSuspend). A seeded rejection removes the fresh markers so the
+ * boundary's catch arm finds the server's catch content intact.
*/
renderUnframed<T>(
render: (target: T) => void,
@@ -19537,6 +19561,8 @@
root: Node | null,
scope: Scope,
slotKey: number,
+ owner: Block,
+ start: Node,
): void {
if (root === null) {
const previousReplay = this.replayDepth;
@@ -19544,30 +19570,74 @@
this.replayDepth = ++this.depth;
try {
render(target);
+ } catch (error) {
+ if (isSuspenseException(error))
+ (this.unframedSuspends ??= new WeakMap()).set(owner, [root, scope, slotKey, start]);
+ else if (this.isRejection(error)) removeRange(start, getNextSibling(end));
+ throw error;
} finally {
this.depth--;
this.replayDepth = previousReplay;
setNativeAdoptionResolver(previousNative);
}
+ this.unframedSuspends?.delete(owner);
return;
}
this.node = root;
- if (!this.renderInPlace(render, target, root, true))
- this.slotMismatch(scope, slotKey, 'a component range', root);
+ try {
+ if (!this.renderInPlace(render, target, root, true))
+ this.slotMismatch(scope, slotKey, 'a component range', root);
+ } catch (error) {
+ if (isSuspenseException(error)) {
+ (this.unframedSuspends ??= new WeakMap()).set(owner, [root, scope, slotKey, start]);
+ this.node = root;
+ } else if (this.isRejection(error)) {
+ removeRange(start, getNextSibling(end));
+ this.node = root;
+ }
+ throw error;
+ }
+ this.unframedSuspends?.delete(owner);
domNode(domNode(end).parentNode!).insertBefore(end, this.node);
}
+ /** The suspended unframed render context `block` left for its retry. */
+ unframedSuspend(block: Block): readonly [Node | null, Scope, number, Node] | undefined {
+ return this.unframedSuspends?.get(block);
+ }
+
/**
- * Resume `source`, the block that a preserved activation suspended in. A
- * source whose first render into its adopted range suspended claims that
- * range again, as the render that suspended did.
+ * Resume `source`, the block that a preserved activation suspended in.
+ * Inside a component whose unframed render suspended, it renders without
+ * adopting, as that render did, and the component completes its claim when
+ * its own slot renders it again. A source whose first render into its
+ * adopted range suspended claims that range again, as the render that
+ * suspended did.
*/
renderSuspended(source: Block): void {
- const claim = this.suspendedClaims?.get(source);
- if (claim !== undefined) {
- this.suspendedClaims!.delete(source);
- this.renderClaimed(source, claim[0], claim[1]);
- } else renderBlock(source);
+ const suspends = this.unframedSuspends;
+ let unframed = false;
+ if (suspends !== null)
+ for (let block: Block | null = source; block !== null && !unframed; block = block.parentBlock)
+ unframed = suspends.has(block);
+ if (!unframed) {
+ const claim = this.suspendedClaims?.get(source);
+ if (claim !== undefined) {
+ this.suspendedClaims!.delete(source);
+ this.renderClaimed(source, claim[0], claim[1]);
+ } else renderBlock(source);
+ return;
+ }
+ const previousReplay = this.replayDepth;
+ const previousNative = setNativeAdoptionResolver(null);
+ this.replayDepth = ++this.depth;
+ try {
+ renderBlock(source);
+ } finally {
+ this.depth--;
+ this.replayDepth = previousReplay;
+ setNativeAdoptionResolver(previousNative);
+ }
}
/**
@@ -32834,21 +32904,43 @@
if (state.inherited) b.exclusiveMarkers = true;
state.block = b;
if (unframed !== undefined)
- hydration!.renderUnframed(renderBlock, b, b.endMarker!, unframed, parentScope, slotKey);
+ hydration!.renderUnframed(
+ renderBlock,
+ b,
+ b.endMarker!,
+ unframed,
+ parentScope,
+ slotKey,
+ b,
+ b.startMarker!,
+ );
// The server may have rendered more in the frame, for another component.
else if (adoptedFrame) hydration!.renderClaimed(b, parentScope, slotKey);
else if (replaced) hydration!.renderUpdate(b);
else renderBlock(b);
}
} else if (state.block) {
+ // A claim whose unframed render suspended completes here.
+ const uf = hydration === null ? undefined : hydration.unframedSuspend(state.block);
// `memo(Component)` — skip the body when new props shallow-equal the
// committed props (React.memo's contract; see tryMemoBail). A string comp
// is never memo-wrapped, so it falls through to the re-render below.
- if (tryMemoBail(state.block, identity, props)) return;
+ if (uf === undefined && tryMemoBail(state.block, identity, props)) return;
if (state.block.props !== renderProps)
journalRootProperty(state.block, 'props', state.block.props);
state.block.props = renderProps;
- renderBlock(state.block);
+ if (uf === undefined) renderBlock(state.block);
+ else
+ hydration!.renderUnframed(
+ renderBlock,
+ state.block,
+ state.block.endMarker!,
+ uf[0],
+ uf[1],
+ uf[2],
+ state.block,
+ uf[3],
+ );
}
// Hydration: advance the cursor PAST this component's adopted range so the next
// sibling adopts from the right node. The body itself doesn't reliably leave theYou can send follow-ups to the cloud agent here.
…ibutes A server text that differs from the client's no longer gets patched to the client value: htext, htextSwap, hempty, binding-view text, a child slot's adopted text and an only-child text host's unclaimed content all throw HydrationMismatch, so the nearest Suspense arm, Hydrate island or the root renders on the client. Texts equal after the HTML parser's normalization, and texts under the host's suppressHydrationWarning, keep the server text. A textarea's text is set to the client's, as React sets its default value. A text that a render-phase update renders again before the pass ends is compared once those updates settle, as React re-runs a component that updates itself before it compares the output. Attributes, class, style and raw HTML are never patched while hydrating: an adopted element keeps the server's value until the client next changes it. Development compares them and publishes one "won't be patched up" warning per hydration pass (settleValues), which also carries the static template differences; production compares nothing. An element the client built still takes the client's values. Under captures that changed before a dormant boundary activated, a differing text or attribute falls the boundary back unreported instead of being repaired. A runtime host's server child that no client child adopts is a mismatch too, except inside <noscript>, whose server content parses as text. Deletes the value-repair machinery: recordTextMismatch, flushTextWarnings and the text warning queue, repaired and journalRepair, keepsServerValue, repairHTML, allowClass, queueClass, flushClassWrites, applyStyle, discardUnclaimedText, warnHydrationValueMismatch and warnHydrationKeptServerValue, and retires error codes 54, 61 and 62. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oundary A <Hydrate> island, a Suspense arm and the root now discard everything a failed hydration attempt left behind, as React deletes a failed boundary's server DOM: - Early host bindings: a mismatch inside a revisioned presentation throws HydrationMismatch instead of refusing the lease (PresentationAdoptionMiss stays for refusals that are not mismatches). A host removed with the boundary's DOM is retired at the root's commit, and a host moved off a site in the discarded DOM is retired when the fallback commits (markHydrationDiscard), so its cleanup runs once and it stops writing. - Seeds: useSeed records the thenable outcomes it writes. A boundary that falls back restores them, and a root attempt journals them, so the client render reads client data. - Replays: an island drops captured intent whose target a fallback discarded instead of resolving it into the client-rendered DOM. - Root: a fallback clears an <html>, <head> or <body> container sparingly, keeping scripts, styles and stylesheet links. The root container and <html>, <head> and <body> skip server elements of another tag and leave them in place, in compiled adoption and in descriptor children. - onRecoverableError reports once per boundary that falls back instead of once per root per microtask. - A Block that an island or arm hydration creates inside an ordinary root transaction keeps its adopted server DOM when that transaction rolls back, as a root's hydrating attempt does. A staged presentation rejection used to delete the island's adopted DOM, which per-site recovery rebuilt and a fallback now discarded. Deletes repairedServerParents and the repaired-parent exemption in host leases, which only per-site recovery needed. The suspended-attempt undo log (save, rollback, speculative) stays: matching content still inserts fresh markers and builds empty ranges, and a nested arm's fallback inside a speculative attempt must be restored for a retry to find its streamed payload. A Document container still clears whole, since the renderer has no host singletons. Rewrites the Hydration section of docs/differences-from-react.md to state React parity and updates docs/ssr.md and docs/deferred-hydration.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: Missing text skips update deferral
- Extended keepsText to defer null-node mismatches when rendersAgain() is true by stashing server/loc in a new deferredNullText field, with callers registering the created Text node via trackDeferredText so settleValues can compare the settled text.
- ✅ Fixed: Settled text skipped after first match
- Restructured keepsText to register the Text node in pendingTexts even when the first render matches the server text, so that a subsequent render-phase update that diverges is caught by settleValues.
- ✅ Fixed: hempty skips framed server text
- Changed hempty to unwrap text-only frames (open + text + close) the same way htext does by re-entering recursively after removing the markers, so framed server text goes through keepsText instead of falling to unclaimedText.
Or push these changes by commenting:
@cursor push c60e71afd0
Preview (c60e71afd0)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -19222,6 +19222,8 @@
private classes: Map<Element, PendingHydrationClass> | null = null;
/** Server texts compared once the pass's render-phase updates settle (keepsText). */
private pendingTexts: Map<Text, PendingHydrationText> | null = null;
+ /** Stashed when keepsText defers a null-node mismatch; claimed by trackDeferredText. */
+ private deferredNullText: PendingHydrationText | null = null;
/**
* DEV-only: the server values this pass kept where the client's differ, by
* their warning line, with the node each belongs to (settleValues).
@@ -19932,6 +19934,7 @@
const keep = text !== '' && this.keepsText(host, null, '', text, (host as any)?.__oct_loc);
const node = (STAGED_DOM?.view(document) ?? document).createTextNode(keep ? '' : text);
domNode((STAGED_DOM?.view(close) ?? close).parentNode)!.insertBefore(node, close);
+ this.trackDeferredText(node);
return node;
}
@@ -20314,24 +20317,32 @@
text: string,
loc: string | undefined,
): boolean {
- if (server === text || isTextParserNormalizedMatch(server, text)) return true;
+ const match = server === text || isTextParserNormalizedMatch(server, text);
if (
+ !match &&
host !== null &&
(this.freshNodes.has(host) ||
(host.nodeType === 1 && (host as Element).localName === 'textarea'))
)
return false;
- if (!this.staleServerValues && isHydrationSuppressed(host)) return true;
- if (node !== null && node.nodeType === 3 && this.rendersAgain()) {
- const pending = (this.pendingTexts ??= new Map());
- if (!pending.has(node as Text)) pending.set(node as Text, { server, loc });
- if (inRootHydrationAttempt()) journalText(node as Text, server);
- if (this.speculative)
- (this.undo ??= []).push(() => {
- (STAGED_DOM?.view(node) ?? node).nodeValue = server;
- });
- return false;
+ if (!match && !this.staleServerValues && isHydrationSuppressed(host)) return true;
+ if (this.rendersAgain()) {
+ if (node !== null && node.nodeType === 3) {
+ const pending = (this.pendingTexts ??= new Map());
+ if (!pending.has(node as Text)) pending.set(node as Text, { server, loc });
+ if (!match) {
+ if (inRootHydrationAttempt()) journalText(node as Text, server);
+ if (this.speculative)
+ (this.undo ??= []).push(() => {
+ (STAGED_DOM?.view(node) ?? node).nodeValue = server;
+ });
+ }
+ } else if (node === null && !match) {
+ this.deferredNullText = { server, loc };
+ }
+ return match;
}
+ if (match) return true;
if (PRESENTATION_HYDRATION?.revision !== undefined) presentationMiss();
this.mismatch(
loc || (host as any)?.__oct_loc,
@@ -20341,6 +20352,19 @@
}
/**
+ * Claims the text node that a caller created after keepsText deferred a
+ * null-node mismatch: registers the node in pendingTexts so settleValues
+ * compares the settled text against the server's.
+ */
+ trackDeferredText(node: Text): void {
+ const deferred = this.deferredNullText;
+ if (deferred !== null) {
+ this.deferredNullText = null;
+ (this.pendingTexts ??= new Map()).set(node, deferred);
+ }
+ }
+
+ /**
* Whether the block rendering now, or an ancestor of it in this pass, has an
* update queued, which renders it again before the pass ends
* (drainHydrationRenderPhaseUpdates).
@@ -20879,6 +20903,7 @@
const keep = text !== '' && this.keepsText(el, null, '', text, loc);
const created = (STAGED_DOM?.view(document) ?? document).createTextNode(keep ? '' : text);
(STAGED_DOM?.view(el) ?? el).appendChild(created);
+ this.trackDeferredText(created);
return created;
}
@@ -20957,12 +20982,16 @@
const first = getFirstChild(el);
if (first === null || (el as Element).localName === 'textarea' || this.freshNodes.has(el))
return null;
+ if (this.isOpen(first)) {
+ const child = getNextSibling(first);
+ const end = child?.nodeType === 3 ? getNextSibling(child) : child;
+ if (this.isClose(end) && getNextSibling(end) === null) {
+ (STAGED_DOM?.view(first) ?? first).remove();
+ (STAGED_DOM?.view(end) ?? end).remove();
+ return this.hempty(el, loc);
+ }
+ }
const next = getNextSibling(first);
- if (this.isOpen(first) && this.isClose(next) && getNextSibling(next) === null) {
- (STAGED_DOM?.view(first) ?? first).remove();
- (STAGED_DOM?.view(next) ?? next).remove();
- return null;
- }
if (first.nodeType === 3 && next === null) {
if (!this.keepsText(el, first, (STAGED_DOM?.view(first) ?? first).nodeValue, '', loc))
(STAGED_DOM?.view(first) ?? first).nodeValue = '';
@@ -20998,6 +21027,7 @@
if (posNode !== null && (STAGED_DOM?.view(posNode) ?? posNode).parentNode !== null) {
domNode((STAGED_DOM?.view(posNode) ?? posNode).parentNode!).insertBefore(created, posNode);
}
+ this.trackDeferredText(created);
return created;
}
@@ -37318,6 +37348,7 @@
const tn = (STAGED_DOM?.view(document) ?? document).createTextNode(str);
(STAGED_DOM?.view(domParent) ?? domParent).insertBefore(tn, state.end);
state.text = tn;
+ if (hydration !== null) hydration.trackDeferredText(tn);
}
// A `{expr}` value-hole slot whose value is USUALLY a primitive (text) — what theYou can send follow-ups to the cloud agent here.
Each rewritten case asserts what React 19.2.7 does for the same fixture, checked with a React-vs-Octane hydration oracle: a failed Suspense/@Try arm or Hydrate island is client-rendered while its siblings keep their nodes, a root without a boundary is client-rendered, attributes keep server values, and one recoverable error is reported per failed boundary or root. Tests that pinned only deleted per-site mechanisms are removed. Remaining failures assert React's outcome where the runtime still diverges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Seed undo lost after suspend
- Added discardAndPassSeeds that runs the restore closures before passing them to the outer hydration, so a retry snapshots the original pre-seed thenable state instead of the already-seeded state.
- ✅ Fixed: Foreign skip stops at comments
- Removed the cursor.nodeType !== 1 early bail in skipForeign, changed the scan loop to continue past non-element nodes, and inverted the deopt walk's while condition to skip non-elements instead of stopping at them.
Or push these changes by commenting:
@cursor push 37195a178f
Preview (37195a178f)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -19391,6 +19391,20 @@
if (seeded !== null) for (let i = seeded.length - 1; i >= 0; i--) seeded[i]();
}
+ /**
+ * Restore the thenables this attempt seeded (so a retry snapshots the
+ * pre-seed state) and hand the closures to `outer` for its own fallback
+ * to run again, idempotently.
+ */
+ discardAndPassSeeds(outer: HydrationCapability | null): void {
+ const seeded = this.seeded;
+ this.seeded = null;
+ if (seeded !== null) {
+ for (let i = seeded.length - 1; i >= 0; i--) seeded[i]();
+ if (outer !== null) (outer.seeded ??= []).push(...seeded);
+ }
+ }
+
/** The attempt is discarded: restore the server nodes it changed. */
rollback(): void {
const undo = this.undo;
@@ -20830,7 +20844,6 @@
): Node | null {
const parent = domNode(cursor).parentNode;
if (
- cursor.nodeType !== 1 ||
parent === null ||
!(
(parent === this.rootBlock.parentNode && this.rootBlock.kind === 'root') ||
@@ -20838,8 +20851,11 @@
)
)
return null;
- for (let node = getNextSibling(cursor); node?.nodeType === 1; node = getNextSibling(node))
- if (template !== null ? hydrationNodeMatches(node, template) : lazyRootMatches(node, lazy!))
+ for (let node = getNextSibling(cursor); node !== null; node = getNextSibling(node))
+ if (
+ node.nodeType === 1 &&
+ (template !== null ? hydrationNodeMatches(node, template) : lazyRootMatches(node, lazy!))
+ )
return node;
return null;
}
@@ -34559,8 +34575,7 @@
let at = up;
while (
at < unstamped.length &&
- unstamped[at].nodeType === 1 &&
- !isHostElementOfType(unstamped[at] as Element, child.type)
+ (unstamped[at].nodeType !== 1 || !isHostElementOfType(unstamped[at] as Element, child.type))
)
at++;
if (at < unstamped.length && unstamped[at].nodeType === 1) up = at;
@@ -39848,10 +39863,11 @@
// arm renders on the client, and its diagnostics describe why.
hydration.releaseDiagnostics(diagnostics, failed && !(failure instanceof HydrationMismatch));
// The arm's client render reads client data. Seeds an attempt that is
- // retried or replaced settled stay with the enclosing hydration, whose
- // own fallback discards them.
+ // retried or replaced are restored so the retry snapshots the pre-seed
+ // state; their closures stay with the enclosing hydration, whose own
+ // fallback discards them.
if (failure instanceof HydrationMismatch) hydration.discardSeeds();
- else if (failed) hydration.passSeeds(previousHydration);
+ else if (failed) hydration.discardAndPassSeeds(previousHydration);
setNativeAdoptionResolver(previousNative);
WIP_CAPTURE = previousCapture;
currentHydration = previousHydration;You can send follow-ups to the cloud agent here.
|
I see the #1772 The test suspends hydration of an early-bound root host. If its root-level neighbor stays in place, handoff succeeds. If the neighbor is removed before the pending promise resolves, the lease refusal should reach The two configurations below vary the fixture compiler's dev option; I did not separately test a production-mode runtime build. This does not establish the outcome of the distinct prior-fallback/reused-container case. Regression patch for the existing behavior-root fixture--- a/packages/octane/tests/behavior-root.test.ts
+++ b/packages/octane/tests/behavior-root.test.ts
@@ -703,6 +703,103 @@
binding.dispose();
}
});
+ }
+
+ for (const dev of [false, true]) {
+ for (const server of ['unchanged', 'externally removed'] as const) {
+ const name =
+ server === 'unchanged'
+ ? 'hands off an early host after suspended hydration when its root neighbor is unchanged'
+ : 'reports a changed early host after suspended hydration when its root neighbor is removed';
+ it(`${name} (${dev ? 'dev' : 'prod'})`, async () => {
+ const source = [
+ "import { useLayoutEffect } from 'octane';",
+ "import { unbound } from 'octane/behavior';",
+ "export function Host(props) @{ 'use dom bindings';",
+ ' <button data-state={props.label}>{unbound(props.children)}</button>',
+ '}',
+ 'export const gate = { pending: undefined };',
+ 'function read() { if (gate.pending !== undefined) throw gate.pending; return "done"; }',
+ 'export function App(props) @{',
+ ' props.onRender();',
+ ' useLayoutEffect(() => { props.onCommit(); }, []);',
+ ' <Host label={read() && props.label}><span>Hello</span></Host>',
+ '}',
+ ].join('\n');
+ let renders = 0;
+ const onCommit = vi.fn();
+ const initial = {
+ label: 'server',
+ onCommit,
+ onRender: () => {
+ if (++renders > 20) throw new Error('Hydration did not converge.');
+ },
+ };
+ const fixture = authoredPresentation('Host', { label: 'server' }, dev, source);
+ container.innerHTML = renderToString(fixture.server.App, initial).html;
+ const button = container.querySelector('button')!;
+ const extra = document.createElement('script');
+ extra.type = 'application/json';
+ extra.textContent = '{}';
+ button.after(extra);
+ const binding = fixture.attach(button, fixture.state);
+ const recoverable = vi.fn();
+ const uncaught = vi.fn();
+ try {
+ fixture.publish({ label: 'early' });
+ const client = fixture.loadClient();
+ let release!: () => void;
+ const pending = new Promise<void>((resolve) => (release = resolve));
+ client.gate.pending = pending;
+ hydratedRoot = hydrateRoot(
+ container,
+ client.App,
+ { ...initial, label: 'hydrated' },
+ {
+ bindingLeases: [binding],
+ onRecoverableError: recoverable,
+ onUncaughtError: uncaught,
+ },
+ );
+ await act(() => {});
+ // The root-level sibling remains in place while hydration is pending.
+ expect(extra.isConnected).toBe(true);
+ expect(onCommit).not.toHaveBeenCalled();
+ expect(fixture.cleanup).not.toHaveBeenCalled();
+ if (server === 'externally removed') extra.remove();
+ client.gate.pending = undefined;
+ await act(async () => {
+ release();
+ await pending;
+ });
+ expect(container.querySelector('button')).toBe(button);
+ if (server === 'externally removed') {
+ // No hydrateRoot caller remains to receive the refusal.
+ expect(uncaught).toHaveBeenCalledOnce();
+ expect(String(uncaught.mock.calls[0]![0])).toMatch(
+ /supported fixed native view|Minified Octane error #75;/,
+ );
+ expect(onCommit).not.toHaveBeenCalled();
+ expect(fixture.cleanup).not.toHaveBeenCalled();
+ fixture.publish({ label: 'still early' });
+ expect(button.getAttribute('data-state')).toBe('still early');
+ return;
+ }
+ expect(uncaught).not.toHaveBeenCalled();
+ expect(recoverable).not.toHaveBeenCalled();
+ expect(extra.isConnected).toBe(true);
+ expect(button.getAttribute('data-state')).toBe('hydrated');
+ expect(onCommit).toHaveBeenCalledOnce();
+ expect(fixture.cleanup).toHaveBeenCalledOnce();
+ fixture.publish({ label: 'retired' });
+ expect(button.getAttribute('data-state')).toBe('hydrated');
+ } finally {
+ hydratedRoot?.unmount();
+ hydratedRoot = undefined;
+ binding.dispose();
+ }
+ });
+ }
}
for (const dev of [false, true]) {I also tested reuse after a verified root fallback: a server/client branch mismatch reported one recoverable error and replaced the server node before the same container was used for the suspended early-bound root. Unchanged-neighbor cases passed both with and without the earlier fallback. Removed-neighbor cases showed the same missing asynchronous error report in both situations; with the scratch retry wrapper, all 12 prior-fallback/removal/compiler-mode combinations passed. These controls do not establish behavior for interleaved roots or delayed boundary activation, and they used a development runtime. |
A root whose hydration fails now renders on the client beside the server DOM and removes it only when that render commits, as React does: a suspended or rolled-back fallback leaves the server nodes in place (never detached), the dev warning and the single onRecoverableError report publish with that commit, a fallback that ends in an uncaught error reports nothing, and one whose render (root, Suspense arm or Hydrate island) catches an error reports only the caught error. Element containers keep renderer-owned <style data-octane> sidecars; a document's root element is restored on rollback. An error thrown while a hydration adopts server DOM now fails the nearest fallback owner even under a catch arm (new error 340, with the thrown error as cause), while errors from client-rendered content still reach catch arms. Production no longer reads the root source for a fragment-root mismatch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…omponent updates like React A server catch arm whose content does not match the client's now fails the nearest fallback owner instead of logging "catch body threw, no outer tryBlock" and leaving an empty range: a catch arm rethrows the mismatch, and a @Try with @pending that adopts its server catch arm is that owner itself (discards its server DOM and the attempt's seeds, renders on the client as a dehydrated boundary, reports once unless that render catches). renderToString of a suspended @Try now marks the @pending arm (<!--oct-client:N-->, new error 341), as React's renderToString writes <!--$!-->: the client renders only that boundary and reports once, or reports only the caught error when its render catches one. A boundary whose hydration failed no longer restarts the Suspense reveal throttle when it shows @pending, as React's dehydrated boundary does not, so its content reveals as soon as its data resolves. Presentation-binding views keep adopting their pending arm. The ErrorBoundary component now renders on the server through ssrTry, so a caught arm carries the catch marker and the client adopts the server fallback instead of reporting a false mismatch. An update that a render schedules for another component, which the server ignores, applies after the hydration it interrupts, as in React: the hydration drain leaves cross-component updates queued, and a hookless child rendered in its parent's block (componentSlotLite) calling a parent setter is a cross-component update, warned in development with the child's name. try-hole-reader: a root fallback whose client render suspends and then catches reports only the caught error. The React 19.2.7 oracle shows 0 recoverable and 1 caught for a root fallback that suspends then catches, and 1 recoverable for a boundary that commits its fallback first; the test now expects that instead of 1 recoverable for the root cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A client that only calls createRoot never hydrates, so its production bundle must ship none of the hydration-only declarations in hydration-free-gates.mjs and no module under packages/octane/src/hydration/. run-hydration-free.mjs builds the #1785 public-root probe, the hydration-free minimal fixtures and the js-framework octane-tsrx app under Vite's default oxc minifier and esbuild's `minify: true`, and reads retention from each bundle's source map, so minifier inlining and mangling cannot hide retained code. Hydrating controls must retain every deny-listed declaration, and each name must still be a top-level declaration of its source, so the list cannot go stale. esbuild never folds a module flag, so esbuild bundles are not held to the six `foldOnly` state cells and accessors (currentHydration, activeHydration, ...), only to the hydration bodies, which must move where client code cannot reach them. The gate fails on the current runtime: every createRoot-only bundle retains 16-22 of the 23 deny-listed declarations. It runs in the shard 1/4 job next to the bundle budgets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…updated boundaries like React React runs a component's whole body before it hydrates any host that body renders, so a body that suspends keeps the server HTML even where a host would not have matched. A compiled body adopts its template's roots first and evaluates its holes after, so a template adoption that fails now defers its mismatch (adoptOrDefer): the body continues on the client into detached DOM, reading seeds as the hydration would, until React's order reaches a host (the template's bag after its holes when it starts with a host, or the next template clone). A suspension before then wins: a Suspense arm's attempt and the root roll back and retry as for any suspension, and a Hydrate island discards the attempt (a new undo log restores what it changed) and adopts afresh when the wakeable settles, instead of resuming a leaf that rendered on the client. The warning is logged only when the mismatch is reached, and an application error the continuation throws fails the owner as the deferred mismatch, whose client render throws it again. New inputs that reach a Suspense arm whose hydration is suspended (root.render or a parent render with new children) client-render the arm with no recoverable error, as React 19 does, instead of hydrating with the new props. A query owner that a mismatched or superseded attempt started is claimed by the arm's client render, so the browser load runs once. A runtime (createElement) host whose server element has fewer children than the client's is a missing node and fails the nearest owner, as in React; <noscript> content stays exempt. A markerless @if/@switch arm whose first render threw after inserting one element (a child of a single-root component suspended) no longer self-marks with that element, so its later siblings render after it when it resumes; this reproduced with createRoot alone (suspended-arm-sibling-order test). Tests: returned-jsx-query-resume's restart scenario and suspense-parent-render-query now expect React 19.2.7's outcome for an update reaching a suspended dehydrated boundary (fallback shown, server output discarded, 0 recoverable errors; probed with a standalone react-dom script and the oracle's --rerender), not a hydration-with-new-props report. suspended-clone-mismatch gains host-first, setup-suspending and mark-then-leaf order cases checked with the oracle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Correction: The regression results in my previous comment came from a scratch runtime whose escape sequences differed from |
|
Follow-up: I reran both focused fixtures in the earlier test harness, with the runtime, related source files, and base test matching the Git blobs at These runs vary the fixture compiler mode and use a development runtime. The wrapper is a diagnostic control, not a reviewed fix. |
…n fallback (#1806) #1784 makes hydration handle mismatches like React 19 and keeps all hydration code out of clients that only call createRoot. Under the size benches' esbuild minifier the hydrating scenarios pay for that split: the flag guards esbuild does not fold, the installed hydration driver, and the boundary fallback's island adoption and seed discard. hydrate-root: raw +1,336, gzip +945, brotli +767 deferred-hydration: raw +2,814, gzip +1,452, brotli +1,257 Measured on #1784 merged with main 8aeb6c0, as measured + headroom. #1784 itself lowers 102 other budgets (every createRoot scenario and app). Co-authored-by: Claude Opus 5.5 <[email protected]>
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
Work counters (an increase fails this check):
44 other measured values are unchanged. Application bundle size (bytes)
9 other measured values are unchanged. Public-import reachability bundles (bytes)
32 other measured values are unchanged. |
…and early branch retry Adds two behavior-root regressions for the React 19 hydration fallback: - An early-bound root-level host whose third-party root neighbor is removed while hydration is suspended refuses its lease when hydration resumes. The root reports that refusal to onUncaughtError once (the retry() wrapper), nothing falls back or commits, and the early owner stays live. With the neighbor unchanged, the host hands off and the sibling stays in place. - A branch the early owner switched since the server rendered is not a mismatch: hydration keeps the early DOM, reports nothing, and adopts it once a later publication renders the client's branch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ration tests Fifteen ledger entries cited hydration test names that this PR renamed when the tests moved to React 19 outcomes. The attribute case (Per :245) is no longer a documented divergence: an adopted element keeps its server attributes with a development warning, as in React, so it is covered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-panels tests - tiptap hydrated hand-written markup without Octane's hydration markers, which are part of the hydration protocol. Its tests now hydrate the shell the server renders (renderHydrationFixture gains a tiptap entry). - resizable-panels rendered the server without storage and hydrated with it. As in React 19, hydration keeps a mismatched attribute's server value, so the server now reads the same storage, as a cookie- or database-backed LayoutStorage does, and the restored layout is adopted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s parity manifest renderHydrationFixture gained a tiptap entry; the pacer manifest pins that support file's sha256. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
A Hydrate island resumes a suspended attempt at the block that suspended, which rendered the body of a call without a server range of its own outside renderUnframed: an in-place body no longer adopted the server node (the island fell back where React adopts) and a body where the server rendered nothing built without reporting. A suspension that escapes renderUnframed now marks the attempt, and the island discards it and adopts afresh once the data arrives (DeferredHydrationSuspension), as React retries a dehydrated boundary; the root and Suspense arms already retry afresh. A client-built cursor at an unframed call is an earlier sibling's markers, past the server's last node, so the server rendered nothing more there: the call hydrates against nothing, as React does, instead of building without a report. The replay mode for it is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion-recovery entry RDX-HYD-006 cited two per-site recovery tests this PR rewrote. Octane now follows React 19 rather than Redact's nearest-host recovery: the nearest Suspense, @Try or <Hydrate> boundary, or the root, renders on the client. The entry's references, contract and rationale say so; the audit doc is regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d framed text in empty holes A component that updates itself while its template renders is rendered again before the pass ends, and React compares only the output that render settles on. Two cases still decided on the first render's text: - Where the server rendered no text (htext, htextSwap, binding-view and child-slot empty paths), keepsText had no node to defer on and threw a mismatch at once, even when the settled text was empty too. The hole now creates its empty Text node first (newText), which stands for the server's empty text, so the comparison waits for settleValues. - A first render that matched the server text was never recorded, so a settled text that differed was patched in place, unreported. An equal text now records too while a block on the render stack has an update queued (QUEUE is empty in the common pass, which skips the walk). hempty unwrapped only an empty server frame, so a text-only <!--[-->text<!--]--> frame over an empty client value was structural content that suppressHydrationWarning could not keep, unlike the same bare text. Both now unwrap as in htext (shared textFrameEnd/unframe). As in React, an empty string compares as the host's text content, which suppression keeps; null, undefined or a boolean hydrate no child, so a server text there is a mismatch suppression does not hide, bare or framed. describeHydrationNode names an empty Text node "nothing". Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ore an unfinished arm a discarded attempt removed The root container and <html>, <head> and <body> skipped only consecutive server elements of another tag, so a comment that a third party inserted there made the root fall back. React 19 skips every comment but its own boundary markers (react-dom 19.2.7: no fallback for a comment before the root, between <head> and <body>, or beside a foreign element; a text node still falls back). skipForeign now steps over comments other than range markers, from the cursor itself, and the document-singleton descriptor walk steps over comments. A text node still ends the search. takeNativeFreshArm removed a renderToString boundary's unfinished @pending arm before the client render without recording the change. An attempt that was then discarded, the root's when a later sibling suspended or an enclosing Suspense arm's, left the boundary empty, and its retry found no marker, so the root fell back with a mismatch instead of reporting the unfinished boundary. It now records the parent first (save), so a discarded attempt restores the server arm. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…w fixes (#1807) #1784's review fixes (render-phase text settling, framed empty-hole text, foreign-comment skipping, unfinished-arm restore) grow the deferred-hydration scenario to 75,733 gzip bytes, 3 over its budget. Raw (237,508) and brotli (65,190) stay within budget. deferred-hydration gzip: 75,730 -> 75,765 (measured + 32) Co-authored-by: Claude Opus 5.5 <[email protected]>
|
@domgan-oai thanks for the focused regression. It's now in 🤖 Addressed by Claude Code |
With #1784's hydrating flag folded by Oxc, Octane's totals shrink 8.5-10% instead of about 5%, so the total-gzip ceilings had grown about 6% loose. They are re-cut at about 1.5% headroom on the merged-source measurement; application-code ceilings are unchanged. All 72 bundle-size guards hold. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the budget conflicts against main after #1784: take main's budgets and lower the 28 values this branch now measures below them (min(main, measured + headroom)); none is raised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ci(bench): measure bundle sizes with Vite 8's default minifier The bundle-size and bundle-reachability harnesses forced Vite's `minify: 'esbuild'`. That mode turns Rolldown's own minifier off, and with it the dead-code elimination that removes branches guarded by a never-written module flag, so the numbers were not what a Vite app ships. - run.mjs builds every framework with `minify: 'oxc'` (Vite 8's default client minifier), still identical settings for every target. - run-minimal.mjs builds its Vite scenarios with `'oxc'`; the esbuild bundler scenarios keep esbuild's `minify: true`. The async-identity encoder check accepts Oxc's template-literal quotes. - Every budget is ratcheted down (144 lowered, 15 unchanged, 0 raised), the bundle-size baseline is re-recorded, the 18 cross-framework ratio guards are re-cut, and the website summary and copy follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-measure the Oxc budgets on main with #1761 and #1782 Budgets move by the measured esbuild-to-Oxc difference on the same source (budget - max(0, esbuild - oxc)), so the methodology change lowers 131 values, keeps 28, raises none, and leaves the headroom #1782 granted to #1783 in place. The baseline, ratio guards and website summary are recomputed from the merged source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(website): compare home summary ceilings at stable precision The smoke test rounds each summary row to 15 significant digits because Math.log/exp can differ by one ULP between libc implementations, but it compared the bundle-size range ends exactly. Those ends are geometric means too: the recorded Solid ceiling was 0.9500824085923075 on macOS and 0.9500824085923076 on the Linux runner. Round them the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-derive the Oxc budgets on main with #1766, #1768, #1770, #1772 and #1794 Same method as before: each budget is main's value minus the measured esbuild-to-Oxc difference on the merged source, never raised (131 lowered, 28 unchanged). The baseline record and home summary follow the new bytes; every ratio guard still holds with the ceilings already cut. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-derive the Oxc budgets on main with #1783 #1783 landed and spent the headroom #1782/#1793/#1794 granted it. Each budget is again main's value minus the measured esbuild-to-Oxc difference on the merged source (131 lowered, 28 unchanged, none raised). The baseline record, home summary and refresh note follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-cut the cross-framework ratio guards after #1784 With #1784's hydrating flag folded by Oxc, Octane's totals shrink 8.5-10% instead of about 5%, so the total-gzip ceilings had grown about 6% loose. They are re-cut at about 1.5% headroom on the merged-source measurement; application-code ceilings are unchanged. All 72 bundle-size guards hold. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
#1784 rewrote renderInitialSuspenseHydration, and hydration now reaches the boundary machinery from more places: the dehydrated-boundary fallback (clientRenderDehydratedTry -> renderDehydratedTry -> mountTry) and two HydrationCapability sites (adoptServerCatch, fallBackServerCatch). Re-apply this branch's goal on top: tryBlock, which alone creates a TrySlot, installs a TRY_OPS table once hydration has started, and every hydration-side caller goes through it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…root fell back (#1826) A previous root's hydration recovery once left its container marked as repaired, so a later root reusing that container could accept an external change to an early host's site while suspended (#1777). The boundary/root fallback redesign (#1784) removed that state: an early host's site check is now purely structural. Run the two suspended early-host handoff groups in a container whose previous root fell back (fallBackOnce, which verifies a real fallback first), and under Strong compilation, so a lingering per-container exemption fails them. Fixes #1777 Co-authored-by: Claude Opus 5.5 <[email protected]>

Fixes #1785
Summary
Octane's hydration now handles mismatches the way React 19 does, and apps that only call
createRootship no hydration code.onRecoverableErrorwith React's message (error code 339). The owner is a server-marked Suspense or@tryboundary, a<Hydrate>island, or the root. A root keeps showing its server DOM until its client render commits.dangerouslySetInnerHTMLare never patched. The server value is kept. Development warns, and production compares nothing, as React does (Client-only createRoot bundles retain HTML hydration normalization #1785).hydrateRoot: this uses Svelte 5's pattern, an import-freehydratingflag plus hydration-only work onHydrationCapabilityor a driver that hydration installs. A new CI gate (run-hydration-free.mjs) fails if anycreateRoot-only scenario keeps one of 23 hydration-only declarations, under Vite or esbuild.Why
HydrationCapabilitygrew from 679 lines (0.2.16) to about 2,900;runtime.tscommits since 2026-09-15 were hydration fixes, almost all of them a new per-site case.The contract (react-dom 19.2.7)
Confirmed from source and probed against React's dev and prod builds with a same-fixture React-vs-Octane oracle.
html/head/bodysuppressHydrationWarningkeeps the server text one level deep.dangerouslySetInnerHTML__htmlrewrites it.onRecoverableErrorfires once per failed boundary or root, and a root reports only if its fallback commits.Octane-specific decisions (maintainer)
@try/@pendingarms with server boundary markers, and<Hydrate>islands, with the root as last resort.ErrorBoundaryand@catchare not hydration boundaries.adoptBindings): their server DOM inside a failed owner is discarded with it. The lease ends once, the binding stops writing, andact()settles.<Hydrate independent>survives a root fallback. The fallback render adopts its wrapper by boundary id, so its DOM and state are kept.Intentional divergences
Matching React exactly would mean shipping and running a structural comparison of everything hydration adopts, which is the work compiled templates exist to avoid. Both are documented in
docs/differences-from-react.md.@ifor@switchbranch with no server range of its own is a structural mismatch and falls back, even where its elements match; React, which has no range markers, adopts them. The markers do not record which arm rendered, so an arm whose elements match the server's arm adopts them, as in React.Also documented: Octane has no host singletons. A
Documentor<html>container that falls back therefore replaces<head>and<body>instead of keeping React's singletons.Sizes
createRootclients: with Vite's default minifier, acreateRootprobe goes from 256,473 to about 237,863 raw (−18.6 kB, −5.1 kB gzip), and the js-framework app drops 7.5 kB raw. With the benches' esbuild minifier, every client scenario drops 2.4–3.1 kB raw, and this PR lowers 102 budgets.Validation
octane+octane-prodvitest: 41,795 tests pass atc11f82e13b. After the final main merge, all 318 hydration files (15,594 tests) pass.octane-signals,octane-signals-prod,octane-signals-strong: 921 tests pass.node benchmarks/bundle-size/run-hydration-free.mjspasses: 14createRootscenarios are hydration-free, and the 3 hydrating controls keep the deny-list.run-minimal.mjs --budgetsandrun.mjs --budgets octane-tsrx octane-jsxpass, andbudget-raises.mjsreports no raise.ci:workflow:test: 369 pass.octane-tscon the octane programs is clean, and Prettier passes on every changed file.pnpm syncleaves no diff.<html>container fallback no longer duplicates head and body, independent islands survive, and silent per-site wrapper recovery is gone. Seeds are discarded on restart, and early-values no longer installs per read. The low-severity cleanups are done too.Risk / follow-ups
<html>fallback: scoped CSS and Float stylesheets that the server placed in<head>are not re-inserted after the fallback, because they are still recorded as present. Element containers, as used by app-core and tanstack-start, are unaffected. A hydration-only fix would move them into the client head at commit.valueandchecked: an adopted control whose server value differs is not yet projected to the client value as React does. This predates this PR and is queued as a separate follow-up.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
High Risk
This rewrites core hydration, SSR boundary markers, and early DOM/signal adoption—any app relying on Octane’s old in-place repair or attribute patching will see different DOM and error reporting at hydrate time.
Overview
Hydration mismatches now follow React 19: structural or text differences no longer trigger in-place subtree repair. The nearest Suspense,
@try,<Hydrate>, or the root drops its server DOM, client-renders, and firesonRecoverableErroronce (new codes 339–341; older per-site mismatch codes are retired). Attributes anddangerouslySetInnerHTMLare not patched—the server value stays, with dev-only warnings. Docs, SSR markers (<!--oct-client:N-->forrenderToStringpending boundaries), early-binding / independent-island behavior, and large test/ledger updates align with that contract.createRoot-only clients shed hydration: module-levelhydrating/hydrationStartedgates plus moving hydration-only paths behindHydrationCapability, lazyNativeAdoptionMiss, andinstallEarlyControlBridgeonly on hydrate entry points enable tree-shaking. CI addsrun-hydration-free.mjs(source-map oracle over 23 deny-listed declarations) and lowers many bundle budgets; hydrating scenarios can grow slightly under esbuild.Reviewed by Cursor Bugbot for commit 9c60c61. Bugbot is set up for automated code reviews on this repo. Configure here.