]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: preserve current hydration node during slot insertion
authordaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 10:23:07 +0000 (18:23 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 10:23:07 +0000 (18:23 +0800)
packages/runtime-vapor/src/component.ts

index a74f690b34cb7b44fdf4265d69b974f534312188..f8980f9ac05ff3b62cd6389cb8c1a446717a954c 100644 (file)
@@ -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) {