@@ -31,7 +31,6 @@ const DELAY_NEXT_TICK = Number.MIN_SAFE_INTEGER;
3131
3232/** @type {undefined | number } */
3333let active_tick_ref = undefined ;
34- let skip_mount_intro = false ;
3534
3635/**
3736 * @template T
@@ -496,7 +495,7 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
496495 can_show_intro_on_mount = true ;
497496 } else if ( transition_block . t === IF_BLOCK ) {
498497 transition_block . r = if_block_transition ;
499- if ( can_show_intro_on_mount && ! skip_mount_intro ) {
498+ if ( can_show_intro_on_mount ) {
500499 /** @type {import('./types.js').Block | null } */
501500 let if_block = transition_block ;
502501 while ( if_block . t === IF_BLOCK ) {
@@ -511,14 +510,13 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
511510 }
512511 }
513512 if ( ! can_apply_lazy_transitions && can_show_intro_on_mount ) {
514- can_show_intro_on_mount = ! skip_mount_intro && transition_block . e !== null ;
513+ can_show_intro_on_mount = transition_block . e !== null ;
515514 }
516515 if ( can_show_intro_on_mount || ! global ) {
517516 can_apply_lazy_transitions = true ;
518517 }
519518 } else if ( transition_block . t === ROOT_BLOCK && ! can_apply_lazy_transitions ) {
520- can_show_intro_on_mount =
521- ! skip_mount_intro && ( transition_block . e !== null || transition_block . i ) ;
519+ can_show_intro_on_mount = transition_block . e !== null || transition_block . i ;
522520 }
523521 transition_block = transition_block . p ;
524522 }
@@ -527,14 +525,11 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
527525 let transition ;
528526
529527 effect ( ( ) => {
528+ let already_mounted = false ;
530529 if ( transition !== undefined ) {
530+ already_mounted = true ;
531531 // Destroy any existing transitions first
532- try {
533- skip_mount_intro = true ;
534- transition . x ( ) ;
535- } finally {
536- skip_mount_intro = false ;
537- }
532+ transition . x ( ) ;
538533 }
539534 const transition_fn = get_transition_fn ( ) ;
540535 /** @param {DOMRect } [from] */
@@ -557,15 +552,15 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
557552 const is_intro = direction === 'in' ;
558553 const show_intro = can_show_intro_on_mount && ( is_intro || direction === 'both' ) ;
559554
560- if ( show_intro ) {
555+ if ( show_intro && ! already_mounted ) {
561556 transition . p = transition . i ( ) ;
562557 }
563558
564559 const effect = managed_pre_effect ( ( ) => {
565560 destroy_signal ( effect ) ;
566561 dom . inert = false ;
567562
568- if ( show_intro ) {
563+ if ( show_intro && ! already_mounted ) {
569564 transition . in ( ) ;
570565 }
571566
@@ -662,7 +657,8 @@ function if_block_transition(transition) {
662657 const c = /** @type {Set<import('./types.js').Transition> } */ ( consequent_transitions ) ;
663658 c . delete ( transition ) ;
664659 if ( c . size === 0 ) {
665- execute_effect ( /** @type {import('./types.js').EffectSignal } */ ( block . ce ) ) ;
660+ const consequent_effect = block . ce ;
661+ execute_effect ( /** @type {import('./types.js').EffectSignal } */ ( consequent_effect ) ) ;
666662 }
667663 } ) ;
668664 } else {
@@ -675,7 +671,8 @@ function if_block_transition(transition) {
675671 const a = /** @type {Set<import('./types.js').Transition> } */ ( alternate_transitions ) ;
676672 a . delete ( transition ) ;
677673 if ( a . size === 0 ) {
678- execute_effect ( /** @type {import('./types.js').EffectSignal } */ ( block . ae ) ) ;
674+ const alternate_effect = block . ae ;
675+ execute_effect ( /** @type {import('./types.js').EffectSignal } */ ( alternate_effect ) ) ;
679676 }
680677 } ) ;
681678 }
0 commit comments