Repository navigation
test(hydration): cover a full component slot rebuilt over a server element in place - #1594
Merged
Merged
Conversation
…ement in place A single-root call that renders through the full component slot (a hooked component, or in a production compile a call whose output reads only constants) and finds no server range of its own renders its template against the server element at the cursor. Before #1561, a mismatch there discarded that element while it was still the block's insert anchor, so commitBag threw NotFoundError and hydrateRoot left the container blank. Pin the recovered behavior in development compile, production compile, and production compile and runtime: the root is rebuilt in the server element's place, its server siblings stay adopted, the mismatch is reported once, and the arm unmounts, remounts and unmounts cleanly afterwards. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 2, 2026 18:58
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)
7 other measured values are unchanged. Public-import reachability bundles (bytes)
69 other measured values are unchanged. |
…pment compile too #1593 discards a mismatched node inside a lite component's host, so the development compile's lite call over the server `<u>` now rebuilds in place like the full component slot does. Cover it in all three modes. 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.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.
Reviewed by Cursor Bugbot for commit 8fe37ca. Configure here.
The constant-output case's note read as if a development compile were left out. It runs in all three modes since #1593: say so. 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
Adds hydration regression tests for a single-root component call that renders through the full component slot and is rebuilt over a mismatched server element in place. This is test-only, with no runtime change and no changeset.
The defect was reported against a base without #1561. Hydrating a hooked single-root call where the server had rendered a different element threw
NotFoundError: The child can not be found in the parent.fromcommitBag, andhydrateRootleft the container blank.adopt()discarded the server node at the cursor while it was still the new block's insert anchor (state.anchor/endMarker). A production compile turns a call whose output reads only constants intocomponentSlotVoid, so that call took the same path and crashed too.#1561 already fixes this on
main.adopt()now keeps the mismatched node until the rebuilt root commits, andrebuiltAtremoves it at that point. The single-rootfinallystamps the block on the rebuilt root. These tests pin that behavior for the reported shape: the call sits in a host element (<section>) inside an@ifarm, with adopted server siblings on both sides.Validation
pnpm format:check, not run repo-wide.pnpm format:files:checkpasses on the two new files.pnpm typecheck, not run repo-wide.pnpm typecheck:filespasses on the two new files.pnpm test, not run locally. CI covers it.vitest run --project octane packages/octane/tests/hydration/in-place-mismatch-full.test.tsmain(5ef4f9a, merged into this branch): 6/6 pass. The cases are a hooked call and a constant-output call, each in development compile, production compile, and production compile and runtime.5378778521'sruntime.ts): the hooked case and the production-compile constant-output cases fail with the reportedNotFoundError. The development-compile constant-output case, which renders through the lite slot, failed onmainbefore Fix hydration mismatch in lite component hosts #1593 because the server<u>was kept.pnpm sync(no generated changes) andnode scripts/check-test-markers.mjsEach case checks:
<em>e</em><p>…</p><b>p</b><hr>;<section>,<em>,<b>and<hr>keep their identity and the<u>is gone;Risk / follow-ups
componentSlotLite). Before Fix hydration mismatch in lite component hosts #1593 that path kept the server<u>and put the rebuilt<p>in front of it. Fix hydration mismatch in lite component hosts #1593 merged while this PR was open, so the case now runs in all three modes.state.anchorstill points at the removed server node, but it is only read when the slot swaps component identity. A compiled call hydrated in place always calls the same component and has no key. The reachable dynamic swap, a component that returns<C />withCchosen per render, anchors on its range marker. I checked it after a mismatched hydration and it works, so no test was added for it.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Test-only additions under
packages/octane/tests/hydrationwith no production code changes.Overview
Adds regression coverage for hydrating a single-root full component slot when the server left a different element at the cursor (e.g.
<u>vs client<p>), so the client rebuilds the component root in place instead of crashing.Introduces fixture
in-place-mismatch-full.tsrxwith an@ifarm that swaps a placeholder<u>for either a hooked component (Para) or a constant-output component (Constant), plus shared siblings (Em,Leaf,<hr>). Newin-place-mismatch-full.test.tsruns six cases (both call shapes × development compile, production compile, and production runtime) and asserts DOM identity, one recoverable mismatch (#51), optional dev-only structural warnings, arm toggle remount behavior, and clean unmount.No runtime or compiler changes—this pins behavior already fixed on
main(#1561 / related slot work).Reviewed by Cursor Bugbot for commit 38ddcc2. Bugbot is set up for automated code reviews on this repo. Configure here.