Skip to content

Commit 3e03b0d

Browse files
committed
wip: save
1 parent 645c553 commit 3e03b0d

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

packages/runtime-vapor/src/components/Teleport.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
runWithoutHydration,
3030
setCurrentHydrationNode,
3131
} from '../dom/hydration'
32+
import { applyTransitionHooks } from './Transition'
3233

3334
export const VaporTeleportImpl = {
3435
name: 'VaporTeleport',
@@ -122,6 +123,9 @@ export class TeleportFragment extends VaporFragment {
122123
if (!this.parent || isHydrating) return
123124

124125
const mount = (parent: ParentNode, anchor: Node | null) => {
126+
if (this.$transition) {
127+
applyTransitionHooks(this.nodes, this.$transition)
128+
}
125129
insert(
126130
this.nodes,
127131
(this.mountContainer = parent),

packages/runtime-vapor/src/components/Transition.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -306,23 +306,21 @@ export function findTransitionBlock(
306306
// use component id as key
307307
if (child && child.$key === undefined) child.$key = block.uid
308308
} else if (isArray(block)) {
309-
child = block[0] as TransitionBlock
310309
let hasFound = false
311310
for (const c of block) {
311+
if (c instanceof Comment) continue
312312
const item = findTransitionBlock(c)
313-
if (item instanceof Element) {
314-
if (__DEV__ && hasFound) {
315-
// warn more than one non-comment child
316-
warn(
317-
'<transition> can only be used on a single element or component. ' +
318-
'Use <transition-group> for lists.',
319-
)
320-
break
321-
}
322-
child = item
323-
hasFound = true
324-
if (!__DEV__) break
313+
if (__DEV__ && hasFound) {
314+
// warn more than one non-comment child
315+
warn(
316+
'<transition> can only be used on a single element or component. ' +
317+
'Use <transition-group> for lists.',
318+
)
319+
break
325320
}
321+
child = item
322+
hasFound = true
323+
if (!__DEV__) break
326324
}
327325
} else if ((isFrag = isFragment(block))) {
328326
if (block.insert) {
@@ -344,7 +342,7 @@ export function setTransitionHooksOnFragment(
344342
hooks: VaporTransitionHooks,
345343
): void {
346344
if (isFragment(block)) {
347-
setTransitionHooks(block, hooks)
345+
block.$transition = hooks
348346
} else if (isArray(block)) {
349347
for (let i = 0; i < block.length; i++) {
350348
setTransitionHooksOnFragment(block[i], hooks)

0 commit comments

Comments
 (0)