2
0
Эх сурвалжийг харах

fix: don't create comment anchor for forwarded slot

daiwei 11 сар өмнө
parent
commit
111f87cf6d

+ 1 - 1
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)

+ 3 - 1
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 {