Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhe141 committed Aug 9, 2024
1 parent 66b16c2 commit bd3ac0e
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions packages/runtime-core/src/components/Teleport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ function hydrateTeleport(
optimized: boolean,
) => Node | null,
): Node | null {
function hydrateDisabledTeleport(
node: Node,
vnode: TeleportVNode,
targetNode: Node | null,
) {
vnode.anchor = hydrateChildren(
nextSibling(node),
vnode,
parentNode(node)!,
parentComponent,
parentSuspense,
slotScopeIds,
optimized,
)
vnode.targetAnchor = targetNode
}
const target = (vnode.target = resolveTarget<Element>(
vnode.props,
querySelector,
Expand All @@ -362,16 +378,7 @@ function hydrateTeleport(
(target as TeleportTargetElement)._lpa || target.firstChild
if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
if (isTeleportDisabled(vnode.props)) {
vnode.anchor = hydrateChildren(
nextSibling(node),
vnode,
parentNode(node)!,
parentComponent,
parentSuspense,
slotScopeIds,
optimized,
)
vnode.targetAnchor = targetNode
hydrateDisabledTeleport(node, vnode, targetNode)
} else {
vnode.anchor = nextSibling(node)

Expand Down Expand Up @@ -408,16 +415,7 @@ function hydrateTeleport(
} else if (isTeleportDisabled(vnode.props)) {
const targetNode = nextSibling(node)
if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
vnode.anchor = hydrateChildren(
nextSibling(node),
vnode,
parentNode(node)!,
parentComponent,
parentSuspense,
slotScopeIds,
optimized,
)
vnode.targetAnchor = targetNode
hydrateDisabledTeleport(node, vnode, targetNode)
}
}
return vnode.anchor && nextSibling(vnode.anchor as Node)
Expand Down

0 comments on commit bd3ac0e

Please sign in to comment.