]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: Merge branch 'edison/fix/resetInsertion' into edison/testVapor
authordaiwei <daiwei521@126.com>
Mon, 16 Jun 2025 02:53:21 +0000 (10:53 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 16 Jun 2025 04:06:24 +0000 (12:06 +0800)
1  2 
packages/runtime-vapor/src/apiCreateIf.ts
packages/runtime-vapor/src/block.ts
packages/runtime-vapor/src/componentSlots.ts
packages/runtime-vapor/src/vdomInterop.ts

index 3e370592b32d118e36736ea7ecee0ec77beaf263,f573a61b16bdf80b475fd251e38f3110916e4b59..ba13df83d70375d3fc0e272ef3cca5f9e988ee27
@@@ -1,6 -1,5 +1,6 @@@
 +import { IF_ANCHOR_LABEL } from '@vue/shared'
  import { type Block, type BlockFn, DynamicFragment, insert } from './block'
- import { isHydrating } from './dom/hydration'
+ import { isHydrating, locateHydrationNode } from './dom/hydration'
  import {
    insertionAnchor,
    insertionParent,
@@@ -16,7 -15,11 +16,11 @@@ export function createIf
  ): Block {
    const _insertionParent = insertionParent
    const _insertionAnchor = insertionAnchor
-   if (!isHydrating) resetInsertionState()
+   if (isHydrating) {
 -    locateHydrationNode()
++    locateHydrationNode(true)
+   } else {
+     resetInsertionState()
+   }
  
    let frag: Block
    if (once) {
index c788ce88559570660879c05938bcbabe28dcc280,b782afd38d35b66c9fed33675d4f4705efbceb3f..6fcec466a33af00a151f93e13ea89ccc0b1d1c7c
@@@ -218,9 -126,10 +218,9 @@@ export function insert
    } else {
      // fragment
      if (block.insert) {
 -      // TODO handle hydration for vdom interop
--      block.insert(parent, anchor)
++      block.insert(parent, anchor, (block as TransitionBlock).$transition)
      } else {
 -      insert(block.nodes, parent, anchor)
 +      insert(block.nodes, parent, anchor, parentSuspense)
      }
      if (block.anchor) insert(block.anchor, parent, anchor)
    }
index b250ecef4915088e3854260acc8cf4085ef8dbf9,100c99cdb8af19f17437e323fbe19806c9769c97..2afe74f9c7ec324fbe24c48aec6d2c71f31c0786
@@@ -123,9 -98,13 +123,13 @@@ export function createSlot
  ): Block {
    const _insertionParent = insertionParent
    const _insertionAnchor = insertionAnchor
-   if (!isHydrating) resetInsertionState()
+   if (isHydrating) {
 -    locateHydrationNode()
++    locateHydrationNode(true)
+   } else {
+     resetInsertionState()
+   }
  
 -  const instance = currentInstance as VaporComponentInstance
 +  const instance = i || (currentInstance as VaporComponentInstance)
    const rawSlots = instance.rawSlots
    const slotProps = rawProps
      ? new Proxy(rawProps, rawPropsProxyHandlers)
index 33680ba7f871d0d005e43cc986f419ee25fa09b1,77228fd72a02fe85a5496daf7d89bc37e197a4d2..4a367b5d9234223a817db62dc22a6a8d6cb67ff9
@@@ -252,35 -175,17 +252,37 @@@ function createVDOMComponent
      internals.umt(vnode.component!, null, !!parentNode)
    }
  
 -  frag.insert = (parentNode, anchor) => {
 -    if (!isMounted) {
 -      internals.mt(
 -        vnode,
 -        parentNode,
 -        anchor,
 -        parentInstance as any,
 -        null,
 -        undefined,
 -        false,
 -      )
 +  vnode.scopeId = parentInstance.type.__scopeId!
 +
-   frag.insert = (parentNode, anchor) => {
++  frag.insert = (parentNode, anchor, transition) => {
 +    const prev = currentInstance
 +    simpleSetCurrentInstance(parentInstance)
 +    if (!isMounted || isHydrating) {
++      if (transition) setVNodeTransitionHooks(vnode, transition)
++
 +      if (isHydrating) {
 +        ;(
 +          vdomHydrateNode ||
 +          (vdomHydrateNode = ensureHydrationRenderer().hydrateNode!)
 +        )(
 +          currentHydrationNode!,
 +          vnode,
 +          parentInstance as any,
 +          null,
 +          null,
 +          false,
 +        )
 +      } else {
 +        internals.mt(
 +          vnode,
 +          parentNode,
 +          anchor,
 +          parentInstance as any,
 +          null,
 +          undefined,
 +          false,
 +        )
 +      }
        onScopeDispose(unmount, true)
        isMounted = true
      } else {
          parentInstance as any,
        )
      }
-     simpleSetCurrentInstance(prev)
 +
-     frag.nodes = vnode.el as Block
 +    // update the fragment nodes
++    frag.nodes = [vnode.el as Node]
++    simpleSetCurrentInstance(prev)
    }
  
    frag.remove = unmount