@@ -27,7 +27,7 @@ import {
2727} from '../component'
2828import { extend , isArray } from '@vue/shared'
2929import { renderEffect } from '../renderEffect'
30- import { type VaporFragment , isFragment } from '../fragment'
30+ import { isFragment } from '../fragment'
3131import {
3232 currentHydrationNode ,
3333 isHydrating ,
@@ -211,15 +211,21 @@ export function applyTransitionHooks(
211211 hooks : VaporTransitionHooks ,
212212 fallthroughAttrs : boolean = true ,
213213) : VaporTransitionHooks {
214+ // filter out comment nodes
215+ if ( isArray ( block ) ) {
216+ block = block . filter ( b => ! ( b instanceof Comment ) )
217+ if ( block . length === 1 ) {
218+ block = block [ 0 ]
219+ } else if ( block . length === 0 ) {
220+ return hooks
221+ }
222+ }
223+
214224 const isFrag = isFragment ( block )
215- const child = findTransitionBlock (
216- block ,
217- // set transition hooks on fragment for reusing during it's updating
218- frag => setTransitionHooksOnFragment ( frag , hooks ) ,
219- isFrag ,
220- )
225+ const child = findTransitionBlock ( block , isFrag )
221226 if ( ! child ) {
222- // if (isFrag) setTransitionHooksOnFragment(block, hooks)
227+ // set transition hooks on fragment for reusing during it's updating
228+ if ( isFrag ) setTransitionHooksOnFragment ( block , hooks )
223229 return hooks
224230 }
225231
@@ -297,7 +303,6 @@ export function applyTransitionLeaveHooks(
297303const transitionBlockCache = new WeakMap < Block , TransitionBlock > ( )
298304export function findTransitionBlock (
299305 block : Block ,
300- processFragment ?: ( frag : VaporFragment ) => void ,
301306 inFragment : boolean = false ,
302307) : TransitionBlock | undefined {
303308 if ( transitionBlockCache . has ( block ) ) {
@@ -311,7 +316,7 @@ export function findTransitionBlock(
311316 } else if ( isVaporComponent ( block ) ) {
312317 // stop searching if encountering nested Transition component
313318 if ( getComponentName ( block . type ) === displayName ) return undefined
314- child = findTransitionBlock ( block . block , processFragment , inFragment )
319+ child = findTransitionBlock ( block . block , inFragment )
315320 // use component id as key
316321 if ( child && child . $key === undefined ) child . $key = block . uid
317322 } else if ( isArray ( block ) ) {
@@ -320,7 +325,7 @@ export function findTransitionBlock(
320325 if ( c instanceof Comment ) continue
321326 // check if the child is a fragment to suppress warnings
322327 if ( isFragment ( c ) ) inFragment = true
323- const item = findTransitionBlock ( c , processFragment , inFragment )
328+ const item = findTransitionBlock ( c , inFragment )
324329 if ( __DEV__ && hasFound ) {
325330 // warn more than one non-comment child
326331 warn (
@@ -339,9 +344,7 @@ export function findTransitionBlock(
339344 if ( block . insert ) {
340345 child = block
341346 } else {
342- processFragment && processFragment ( block )
343- // once we encounter a fragment, we are inside a fragment
344- child = findTransitionBlock ( block . nodes , processFragment , true )
347+ child = findTransitionBlock ( block . nodes , true )
345348 }
346349 }
347350
0 commit comments