]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(createKeyedFragment): use isLastInsertion for hydration node advancement edison/testVapor 13383/head
authordaiwei <daiwei521@126.com>
Mon, 20 Oct 2025 01:28:30 +0000 (09:28 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 20 Oct 2025 01:28:30 +0000 (09:28 +0800)
packages/runtime-vapor/src/apiCreateFragment.ts

index a1b3fe29763b0ce2747c39a5e768bd93d17b6565..3e40281a0237be7420ea1bf834b2e4692c7add0e 100644 (file)
@@ -4,6 +4,7 @@ import { DynamicFragment } from './fragment'
 import {
   insertionAnchor,
   insertionParent,
+  isLastInsertion,
   resetInsertionState,
 } from './insertionState'
 import { renderEffect } from './renderEffect'
@@ -11,6 +12,7 @@ import { renderEffect } from './renderEffect'
 export function createKeyedFragment(key: () => any, render: BlockFn): Block {
   const _insertionParent = insertionParent
   const _insertionAnchor = insertionAnchor
+  const _isLastInsertion = isLastInsertion
   if (!isHydrating) resetInsertionState()
 
   const frag = __DEV__ ? new DynamicFragment('keyed') : new DynamicFragment()
@@ -21,7 +23,7 @@ export function createKeyedFragment(key: () => any, render: BlockFn): Block {
   if (!isHydrating) {
     if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor)
   } else {
-    if (_insertionAnchor !== undefined) {
+    if (_isLastInsertion) {
       advanceHydrationNode(_insertionParent!)
     }
   }