Explorar o código

fix: preserve current hydration node during slot insertion

daiwei hai 11 meses
pai
achega
a6e039865e
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      packages/runtime-vapor/src/component.ts

+ 8 - 1
packages/runtime-vapor/src/component.ts

@@ -568,12 +568,19 @@ export function createComponentWithFallback(
   }
 
   if (rawSlots) {
-    isHydrating && setCurrentHydrationNode(el.firstChild)
+    let prev: Node
+    if (isHydrating) {
+      prev = currentHydrationNode!
+      setCurrentHydrationNode(el.firstChild)
+    }
     if (rawSlots.$) {
       // TODO dynamic slot fragment
     } else {
       insert(getSlot(rawSlots as RawSlots, 'default')!(), el)
     }
+    if (isHydrating) {
+      setCurrentHydrationNode(prev!)
+    }
   }
 
   if (!isHydrating && _insertionParent) {