]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: don't create comment anchor for forwarded slot
authordaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 08:15:54 +0000 (16:15 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 08:15:54 +0000 (16:15 +0800)
packages/runtime-vapor/src/componentSlots.ts
packages/runtime-vapor/src/fragment.ts

index 3a965c2c06b491cd9cbd0ee7e07afa97a6e44e6d..4fcb86a39fac611fd347f8582636ca54c31f77c5 100644 (file)
@@ -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)
index 2f6d3b42ad64ce1b7c8a9709f3cf52f5c03569f1..9971183ba12d8a6822e6a483b52510c81f4cf08e 100644 (file)
@@ -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 {