wip: skip hydration for empty forwarded slots
ci / test (push) Waiting to run Details
ci / continuous-release (push) Waiting to run Details

This commit is contained in:
daiwei 2025-07-31 21:13:01 +08:00
parent 1b0818bcde
commit 8d4f178dcc
2 changed files with 11 additions and 1 deletions

View File

@ -136,7 +136,7 @@ export function createSlot(
)
} else {
fragment =
(isHydrating || __DEV__) && !i
isHydrating || __DEV__
? new DynamicFragment(SLOT_ANCHOR_LABEL)
: new DynamicFragment()
const isDynamicName = isFunction(name)

View File

@ -139,7 +139,17 @@ export class DynamicFragment extends VaporFragment {
}
setActiveSub(prevSub)
if (isHydrating && this.anchorLabel) {
// skip hydration for empty forwarded slots because
// the server output does not include their anchors
if (
this.nodes instanceof DynamicFragment &&
this.nodes.forwarded &&
!isValidBlock(this.nodes)
) {
return
}
this.hydrate(this.anchorLabel)
}
}