@@ -482,33 +482,43 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
482
482
// @ts -ignore
483
483
dom . __animate = true ;
484
484
}
485
-
485
+ let foo = false ;
486
486
/** @type {import('./types.js').Block | null } */
487
487
let transition_block = block ;
488
- while ( transition_block !== null ) {
488
+ main: while ( transition_block !== null ) {
489
489
if ( is_transition_block ( transition_block ) ) {
490
490
if ( transition_block . t === EACH_ITEM_BLOCK ) {
491
491
// Lazily apply the each block transition
492
492
transition_block . r = each_item_transition ;
493
493
transition_block . a = each_item_animate ;
494
494
transition_block = transition_block . p ;
495
495
} else if ( transition_block . t === AWAIT_BLOCK && transition_block . n /* pending */ ) {
496
- can_show_intro_on_mount = false ;
496
+ can_show_intro_on_mount = true ;
497
497
} else if ( transition_block . t === IF_BLOCK ) {
498
498
transition_block . r = if_block_transition ;
499
+ if ( can_show_intro_on_mount ) {
500
+ /** @type {import('./types.js').Block | null } */
501
+ let if_block = transition_block ;
502
+ while ( if_block . t === IF_BLOCK ) {
503
+ // If we have an if block parent that is currently falsy then
504
+ // we can show the intro on mount as long as that block is mounted
505
+ if ( if_block . e !== null && ! if_block . v ) {
506
+ can_show_intro_on_mount = true ;
507
+ break main;
508
+ }
509
+ if_block = if_block . p ;
510
+ }
511
+ }
499
512
}
500
513
if ( ! can_apply_lazy_transitions && can_show_intro_on_mount ) {
501
- can_show_intro_on_mount = transition_block . e === null ;
514
+ can_show_intro_on_mount = transition_block . e !== null ;
515
+ foo = true ;
502
516
}
503
- if ( ! can_show_intro_on_mount || ! global ) {
517
+ if ( can_show_intro_on_mount || ! global ) {
504
518
can_apply_lazy_transitions = true ;
505
519
}
506
- } else if (
507
- ! can_apply_lazy_transitions &&
508
- transition_block . t === ROOT_BLOCK &&
509
- ( transition_block . e !== null || transition_block . i )
510
- ) {
511
- can_show_intro_on_mount = false ;
520
+ } else if ( transition_block . t === ROOT_BLOCK && ! can_apply_lazy_transitions ) {
521
+ can_show_intro_on_mount = transition_block . e !== null || transition_block . i ;
512
522
}
513
523
transition_block = transition_block . p ;
514
524
}
@@ -540,7 +550,7 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
540
550
541
551
transition = create_transition ( dom , init , direction , transition_effect ) ;
542
552
const is_intro = direction === 'in' ;
543
- const show_intro = ! can_show_intro_on_mount && ( is_intro || direction === 'both' ) ;
553
+ const show_intro = can_show_intro_on_mount && ( is_intro || direction === 'both' ) ;
544
554
545
555
if ( show_intro ) {
546
556
transition . p = transition . i ( ) ;
@@ -602,7 +612,7 @@ export function trigger_transitions(transitions, target_direction, from) {
602
612
transition . c ( ) ;
603
613
}
604
614
transition . d . inert = false ;
605
- mark_subtree_inert ( effect , effect , false ) ;
615
+ mark_subtree_inert ( effect , false ) ;
606
616
} else if ( target_direction === 'key' ) {
607
617
if ( direction === 'key' ) {
608
618
transition . p = transition . i ( /** @type {DOMRect } */ ( from ) ) ;
@@ -614,7 +624,7 @@ export function trigger_transitions(transitions, target_direction, from) {
614
624
outros . push ( transition . o ) ;
615
625
}
616
626
transition . d . inert = true ;
617
- mark_subtree_inert ( effect , effect , true ) ;
627
+ mark_subtree_inert ( effect , true ) ;
618
628
}
619
629
}
620
630
if ( outros . length > 0 ) {
0 commit comments