Skip to content

Commit 2ea1e12

Browse files
committed
fix(hydration): settle a framed component's claim from its markerless branch
When a framed component has no wrapper template of its own (its body is a markerless @if/@switch), renderOwned opens a nested beginClaim/endClaim for the branch arm. The inner endClaim restores the parent's unsettled claimEnd (undefined) and clears claimFrom, so renderClaimed's endClaim returns from=undefined and settleClaim's cursor fallback cannot find the stale server tail after the arm's adopted roots. Fix: in renderClaimed, save heldClaim before renderBlock and clear it. After endClaim, when the claim was not settled (from===undefined) but renderOwned set heldClaim during the render, use it as from. This propagates the markerless branch's settlement to the enclosing frame without leaking into renderAdoptedArm's separate claim path.
1 parent 0d67b3e commit 2ea1e12

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19456,6 +19456,8 @@ class HydrationCapability {
1945619456
*/
1945719457
renderClaimed(block: Block, scope: Scope, slotKey: number): void {
1945819458
const outer = this.beginClaim(getNextSibling(block.startMarker!));
19459+
const previousHeld = this.heldClaim;
19460+
this.heldClaim = undefined;
1945919461
let from: Node | null | undefined;
1946019462
try {
1946119463
renderBlock(block);
@@ -19465,6 +19467,10 @@ class HydrationCapability {
1946519467
throw error;
1946619468
} finally {
1946719469
from = this.endClaim(outer);
19470+
// When the component's content is a markerless branch whose template
19471+
// adopted the range's first node, its settlement is the frame's.
19472+
if (from === undefined && this.heldClaim !== undefined) from = this.heldClaim;
19473+
this.heldClaim = previousHeld;
1946819474
}
1946919475
if (!block.disposed) this.settleClaim(block, block.endMarker!, from, scope, slotKey);
1947019476
}

0 commit comments

Comments
 (0)