Repository navigation
fix(hydration): repair stale dormant Hydrate captures without side renders - #1282
Merged
Merged
Conversation
…nders When a mounted parent changes a dormant Hydrate boundary's captures or provided context before activation, the server HTML predates the client's state. Decide that by comparing the initial and current captures instead of rendering the child with its historical props, and repair attributes, class, style and text without mismatch diagnostics in dev and prod. Removes the development-only historical attribute probe (#1181) and the native-signal isolation built on it (#1238), which re-ran component bodies, state initializers, memo factories and getSnapshot with stale props. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
September 23, 2026 11:22
3 of 5 tasks
trueadm
added a commit
that referenced
this pull request
Sep 23, 2026
… fast path #1282 removed `hydrateAttributeProbe` along with the side-render capture it served, deleting this exact guard from `nativePresentationBinding`. #1270, branched earlier, copied that guard into its new scalar-literal fast path in `nativeStyleBinding`. Both merged, leaving main referencing an undefined name: `tsc` fails (TS2304), the octane build and every package pack fail, and in dev the fast path throws `ReferenceError: hydrateAttributeProbe is not defined` (#1270's own style-transaction and signal-binding tests fail). Drop the guard to match #1282's removal in the general path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
added a commit
that referenced
this pull request
Sep 23, 2026
… fast path (#1283) #1282 removed `hydrateAttributeProbe` along with the side-render capture it served, deleting this exact guard from `nativePresentationBinding`. #1270, branched earlier, copied that guard into its new scalar-literal fast path in `nativeStyleBinding`. Both merged, leaving main referencing an undefined name: `tsc` fails (TS2304), the octane build and every package pack fail, and in dev the fast path throws `ReferenceError: hydrateAttributeProbe is not defined` (#1270's own style-transaction and signal-binding tests fail). Drop the guard to match #1282's removal in the general path. Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Follow-up to #1181 (review items D2, D3, D4).
Hydrateboundary's captures before activation, development rendered the whole child subtree an extra time, with the old props, in a detached document. That ran component bodies,useStateinitializers,useMemofactories andgetSnapshot, which production never did ([render:a, init:a, snap:a, snap:a, render:b, …]vs[render:b, …]). Octane documents no StrictMode double-invoke, so this probe is removed along with the native-signal support fix(hydration): isolate native signal attribute diagnostics #1238 added on top of it: the ~20 saved-and-restored runtime globals, thehydrateAttributeProbeguards, theuseSignal$diagnostic initializer and the staged-DOM allowlist entries.onRecoverableError(error And again #61) in production andconsole.errorin development. fix: distinguish dormant capture updates from hydration mismatches #1181 fixed this for attributes only.How it works now
Each dormant, server-preserved boundary keeps the captures and provided context values it was first claimed with, until it activates. Activation compares them with the current ones:
__datacapture array.When anything changed, the server HTML predates the client's state. Activation then repairs attributes, class, style and text without a warning or
onRecoverableError. A boundary claimed inside such a boundary inherits this. When the captures are unchanged, for example after a parent re-render with equal values, real mismatches are still reported. No child render happens either way.Contract change: #1181 also promised that a genuine initial mismatch would still be diagnosed after a later capture change corrected it. That requires rendering the stale captures, so it is dropped. Such a mismatch is now repaired silently.
docs/deferred-hydration.mdis updated to match.D4
The
SUSPENSE_RESOLVED_COMMENTbranch oftakeInitialSuspenseHydrationdoes buildidStatewithoutsignalState, but the fallback it feeds is never reached, so this PR leaves it unchanged:While checking this I found that island client keys carry an extra
["legacy",[],""]segment the server keys don't have. I have not yet shown a user-visible effect; it is being investigated separately.Cost
Production, measured on the Hydrate test fixtures with esbuild minify and gzip:
Hydrate;Development loses the whole probe path.
Validation
pnpm format:files:check)pnpm typecheck:files, tsrx-tsc)pnpm test, run as CI runs it: 4 shards withvitest.ci-sharded.config.js, 29,980 tests passing. The single-processpnpm testruns out of heap on this machine.packages/octane/tests/hydration(octane and octane-prod projects): 2,040 tests passing after rebasing onto current main.scripts/check-staged-domand its tests pass.render:first, init:first….pnpm format:checkandpnpm typecheckwere not run; only the scoped versions above.Risk / follow-ups
children, aHydratenot imported fromoctane) are treated as changed whenever the function identity differs. Diagnostics are skipped there rather than reported falsely.@ifarm is still reported as a recoverable structural mismatch. This PR only covers value-level diagnostics.suppressHydrationWarninganddangerouslySetInnerHTMLstill keep the server value, as before.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes core deferred-hydration activation and mismatch reporting in dev and prod; behavior is broad but covered by extensive hydration tests and narrows false positives rather than skipping checks when captures are unchanged.
Overview
Dormant
Hydrateboundaries no longer get an extra development-only render against old closure captures. That detached probe (and the relatedhydrateAttributeProbe, native-read pauses, anduseSignal$diagnostic initializer) is removed so dev and prod follow the same activation path.Instead, server-preserved boundaries record initial captures and context at claim time. On activation, Octane compares them to the current props/context (compiler
CHILDREN_CAPTURESin production for unsplit children). If anything changed,staleServerValuesis set and attributes, class, style, and text are repaired silently—noconsole.errororonRecoverableError. Nested boundaries inherit stale server HTML from an activating parent. Unchanged captures still surface real server/client mismatches as before.Contract change: an initial mismatch that a later capture update would have “fixed” before activation is now repaired without a diagnostic (docs updated).
Reviewed by Cursor Bugbot for commit 2885e41. Bugbot is set up for automated code reviews on this repo. Configure here.