Skip to content

Commit 7f4cb37

Browse files
committed
fix(hydration): run range-size check on resume when claimFrom is cleared
The fragment range-size check (claimRoots) was guarded by `cursor !== this.claimFrom`, which short-circuits to true when claimFrom is null — as it is after endClaim clears it following a child suspension. This allowed a hole-then-text fragment (no static element root for fragmentRootMatches to reject) to be adopted over another component's server range instead of being rebuilt. Guard the short-circuit with `this.claimFrom !== null` so that when claimFrom has been cleared, claimRoots always runs. claimRoots independently identifies range boundaries via liteRanges and returns true immediately for cursors not at a range start, preserving the fast path.
1 parent 7e61cda commit 7f4cb37

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20475,7 +20475,11 @@ class HydrationCapability {
2047520475
// Roots that outnumber what the server rendered there, such as holes
2047620476
// with no static element root after them, belong to other content,
2047720477
// and only a rebuild creates them.
20478-
if (cursor !== this.claimFrom || this.claimRoots(cursor, template ?? lazy!) || claimsRoot)
20478+
if (
20479+
(this.claimFrom !== null && cursor !== this.claimFrom) ||
20480+
this.claimRoots(cursor, template ?? lazy!) ||
20481+
claimsRoot
20482+
)
2047920483
return { __oct_vfrag: true, firstChild: cursor } as unknown as Node;
2048020484
}
2048120485
return this.rebuildFragment(template ?? resolveLazyTemplate(lazy!), cursor, loc);

0 commit comments

Comments
 (0)