Skip to content

Commit 619671f

Browse files
committed
fix(hydration): loop past consecutive close markers in discardArmTail
When a rebuilt @Try is nested inside another @Try (or child slot), the cursor parks on the inner close marker. A single getNextSibling hop lands on the outer close marker, so isOpen fails and the unclaimed tail stays in the document. Change the single if-step to a while loop that skips past consecutive close markers (stopping at `end` to stay in bounds), so the open-tail check sees the correct node regardless of nesting depth.
1 parent 379a2b9 commit 619671f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19407,9 +19407,10 @@ class HydrationCapability {
1940719407
* Runs after a branch's first hydrating render, which adopted the server's
1940819408
* arm range from `first` to `end`. Every range the arm claims parks the
1940919409
* cursor past it, or on its close marker when the slot rebuilt its content
19410-
* (a @try body that threw on the client), so once the arm has claimed
19411-
* something, a server range at the cursor or just after that marker is one
19412-
* that nothing in the arm claimed: the server rendered another arm here,
19410+
* (a @try body that threw on the client — possibly nested, producing
19411+
* consecutive close markers), so once the arm has claimed something, a
19412+
* server range at the cursor or just past those markers is one that
19413+
* nothing in the arm claimed: the server rendered another arm here,
1941319414
* longer than this one. Discard the server content from there up to `end`,
1941419415
* stopping at any client nodes that mismatch recovery built there, and
1941519416
* report it once.
@@ -19423,7 +19424,7 @@ class HydrationCapability {
1942319424
discardArmTail(scope: Scope, slotKey: number, first: Node, end: Node): void {
1942419425
let from = this.node;
1942519426
if (from === first) return;
19426-
if (this.isClose(from)) from = getNextSibling(from);
19427+
while (this.isClose(from) && from !== end) from = getNextSibling(from);
1942719428
if (!this.isOpen(from)) return;
1942819429
let stop: Node | null = null;
1942919430
let node: Node | null = from;

0 commit comments

Comments
 (0)