Repository navigation
fix: distinguish dormant capture updates from hydration mismatches - #1181
Merged
domgan-oai merged 1 commit intoSep 20, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
September 20, 2026 17:56
5 of 6 tasks
domgan-oai
pushed a commit
that referenced
this pull request
Sep 23, 2026
…nders (#1282) 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]>
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
A mounted parent update to a dormant
Hydrateboundary could report attribute mismatches for valid updates, while an initial mismatch corrected before activation could disappear from diagnostics. Compare development attribute diagnostics with the initial client captures and provider values, while activating the live child with the latest captures.Fixes #1172.
whenavoids an unnecessary child render. Keep guarded or opaque template reads conservative.Validation
octaneandoctane-prodwith--maxWorkers=4: 142 files, 1,786 tests passed.tsrx-tsctypecheck for changed Octane source/tests and the new fixture; scoped formatting andgit diff --check.pnpm sync; no additional generated changes.pnpm format:check(used scoped checks locally)pnpm typecheck(used scoped checks locally)pnpm test(used targeted suites locally)The unrestricted broad run hit two existing 5,000 ms SSR diagnostic deadlines. That suite passed all 12 cases in isolation, and the four-worker broad run passed all 1,786 cases without changing deadlines or assertions.
Matched nine-sample
benchmarks/deferred-hydration-boundaries/run.mjscontrols pass: server adoption, sidecar cleanup, unmount, and Set allocations remain 14/6,155 for 1/2,048 boundaries, exactly 3 Sets per additional boundary. Timings had substantial machine drift/noise, so no speed claim is made. The production runtime is byte-identical before identifier mangling (821,892 bytes); the fully minified envelope differs by +8 bytes/+11 gzip bytes solely from short-name assignment. The development envelope adds 5,109 bytes/1,722 gzip bytes.Risk / follow-ups
Development activation with changed captures can evaluate the initial child render in a detached tree solely to collect attribute diagnostics. It never commits historical hook state, refs, or effects. Unavailable historical data and unsupported native computations retain ordinary checks at unvisited sites; structural recovery behavior is unchanged. Local DOM evidence uses the public SSR/compiler/runtime path in Happy DOM; no physical-device qualification was run.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core deferred-hydration activation and dev-only diagnostic rendering in
runtime.ts; production is mostly gated, but dormant-boundary behavior and compiler dev output change.Overview
Fixes false dev hydration warnings when a mounted parent updates a dormant
Hydrateboundary, while still reporting real initial server/client attribute, class, and style mismatches—even if props are corrected before activation.Runtime (dev): Snapshots initial boundary props, contexts, and IDs; when captures change, re-renders the initial child tree in an inert document (
hydrateAttributeProbe) to baseline attributes. Live activation uses latest captures; mismatch warnings compare server HTML to that baseline, not post-update values. Side effects during the probe are fenced (signals, native reads/hooks, portals, float resources, retries, HMR, etc.).Compiler (dev): Emits lazy
CHILDREN_DIAGNOSTIC_CAPTURESwitnesses onHydratechildren blocks (conservative when control flow/getters/shadows are unsafe). Unsplit boundaries can avoid rendering the child untilwhenchanges.Docs, changeset, broad split/unsplit consumer tests, AST immutability control, and staged-DOM exemptions for the diagnostic pass.
Reviewed by Cursor Bugbot for commit 9ec5a86. Bugbot is set up for automated code reviews on this repo. Configure here.