From: daiwei Date: Wed, 30 Jul 2025 08:15:54 +0000 (+0800) Subject: fix: don't create comment anchor for forwarded slot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=111f87cf6df377179ee25925ca727acdda469c1a;p=thirdparty%2Fvuejs%2Fcore.git fix: don't create comment anchor for forwarded slot --- diff --git a/packages/runtime-vapor/src/componentSlots.ts b/packages/runtime-vapor/src/componentSlots.ts index 3a965c2c06..4fcb86a39f 100644 --- a/packages/runtime-vapor/src/componentSlots.ts +++ b/packages/runtime-vapor/src/componentSlots.ts @@ -136,7 +136,7 @@ export function createSlot( ) } else { fragment = - isHydrating || __DEV__ + (isHydrating || __DEV__) && !i ? new DynamicFragment(SLOT_ANCHOR_LABEL) : new DynamicFragment() const isDynamicName = isFunction(name) diff --git a/packages/runtime-vapor/src/fragment.ts b/packages/runtime-vapor/src/fragment.ts index 2f6d3b42ad..9971183ba1 100644 --- a/packages/runtime-vapor/src/fragment.ts +++ b/packages/runtime-vapor/src/fragment.ts @@ -140,7 +140,9 @@ export class DynamicFragment extends VaporFragment { } setActiveSub(prevSub) - if (isHydrating) this.hydrate(this.anchorLabel!) + if (isHydrating && this.anchorLabel) { + this.hydrate(this.anchorLabel) + } } hydrate(label: string): void {