Skip to content

Commit 8dca775

Browse files
committed
fix(hydration): skip parkPast in errorBlock when parent is disposed
mountErrorBoundary returns early when state.parentBlock.disposed is true (after unmountBlock disposes the parent or after a replay-unmount disposal). The caller errorBlock then unconditionally ran parkPast(state.end, parentScope), overwriting the hydration cursor an ancestor catch boundary already placed. state.end may be detached at that point, so getNextSibling returns null and later siblings adopt from the wrong node. Guard the parkPast call with !state.parentBlock.disposed so a disposed boundary does not interfere with the ancestor's cursor.
1 parent c3462a9 commit 8dca775

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39105,8 +39105,11 @@ export function errorBlock(
3910539105
}
3910639106
} else mountErrorBoundary(state, hydration);
3910739107
// Hydration: park past the boundary's range, as every slot does, so a
39108-
// following sibling adopts its own server content.
39109-
if (!state.passthrough) hydration?.parkPast(state.end, parentScope);
39108+
// following sibling adopts its own server content. Skip when the parent was
39109+
// disposed during mount — an ancestor boundary already owns the cursor and
39110+
// state.end may be detached.
39111+
if (!state.passthrough && !state.parentBlock.disposed)
39112+
hydration?.parkPast(state.end, parentScope);
3911039113
return state.reset;
3911139114
}
3911239115

0 commit comments

Comments
 (0)