@@ -70,7 +70,7 @@ import {
7070} from './hydration.js' ;
7171import { array_from , define_property , get_descriptor , get_descriptors , is_array } from './utils.js' ;
7272import { is_promise } from '../common.js' ;
73- import { bind_transition , remove_in_transitions , trigger_transitions } from './transitions.js' ;
73+ import { bind_transition , trigger_transitions } from './transitions.js' ;
7474
7575/** @type {Set<string> } */
7676const all_registerd_events = new Set ( ) ;
@@ -1355,8 +1355,6 @@ export function slot(anchor_node, slot_fn, slot_props, fallback_fn) {
13551355function if_block ( anchor_node , condition_fn , consequent_fn , alternate_fn ) {
13561356 const block = create_if_block ( ) ;
13571357 hydrate_block_anchor ( anchor_node ) ;
1358- const consequent_transitions = new Set ( ) ;
1359- const alternate_transitions = new Set ( ) ;
13601358 const previous_hydration_fragment = current_hydration_fragment ;
13611359
13621360 /** @type {null | import('./types.js').TemplateNode | Array<import('./types.js').TemplateNode> } */
@@ -1366,59 +1364,32 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
13661364 let has_mounted = false ;
13671365 let has_mounted_branch = false ;
13681366
1369- block . r =
1370- /**
1371- * @param {import('./types.js').Transition } transition
1372- * @returns {void }
1373- */
1374- ( transition ) => {
1375- // block.current
1376- if ( block . c ) {
1377- consequent_transitions . add ( transition ) ;
1378- transition . f ( ( ) => {
1379- consequent_transitions . delete ( transition ) ;
1380- remove_in_transitions ( consequent_transitions ) ;
1381- if ( consequent_transitions . size === 0 ) {
1382- execute_effect ( consequent_effect ) ;
1383- }
1384- } ) ;
1385- } else {
1386- alternate_transitions . add ( transition ) ;
1387- transition . f ( ( ) => {
1388- alternate_transitions . delete ( transition ) ;
1389- remove_in_transitions ( alternate_transitions ) ;
1390- if ( alternate_transitions . size === 0 ) {
1391- execute_effect ( alternate_effect ) ;
1392- }
1393- } ) ;
1394- }
1395- } ;
13961367 const if_effect = render_effect (
13971368 ( ) => {
13981369 const result = ! ! condition_fn ( ) ;
1399- if ( block . c !== result || ! has_mounted ) {
1400- block . c = result ;
1370+ if ( block . v !== result || ! has_mounted ) {
1371+ block . v = result ;
14011372 if ( has_mounted ) {
1373+ const consequent_transitions = block . c ;
1374+ const alternate_transitions = block . a ;
14021375 if ( result ) {
1403- remove_in_transitions ( alternate_transitions ) ;
1404- if ( alternate_transitions . size === 0 ) {
1376+ if ( alternate_transitions === null || alternate_transitions . size === 0 ) {
14051377 execute_effect ( alternate_effect ) ;
14061378 } else {
14071379 trigger_transitions ( alternate_transitions , 'out' ) ;
14081380 }
1409- if ( consequent_transitions . size === 0 ) {
1381+ if ( consequent_transitions === null || consequent_transitions . size === 0 ) {
14101382 execute_effect ( consequent_effect ) ;
14111383 } else {
14121384 trigger_transitions ( consequent_transitions , 'in' ) ;
14131385 }
14141386 } else {
1415- remove_in_transitions ( consequent_transitions ) ;
1416- if ( consequent_transitions . size === 0 ) {
1387+ if ( consequent_transitions === null || consequent_transitions . size === 0 ) {
14171388 execute_effect ( consequent_effect ) ;
14181389 } else {
14191390 trigger_transitions ( consequent_transitions , 'out' ) ;
14201391 }
1421- if ( alternate_transitions . size === 0 ) {
1392+ if ( alternate_transitions === null || alternate_transitions . size === 0 ) {
14221393 execute_effect ( alternate_effect ) ;
14231394 } else {
14241395 trigger_transitions ( alternate_transitions , 'in' ) ;
@@ -1455,7 +1426,7 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
14551426 remove ( consequent_dom ) ;
14561427 consequent_dom = null ;
14571428 }
1458- if ( block . c ) {
1429+ if ( block . v ) {
14591430 consequent_fn ( anchor_node ) ;
14601431 if ( ! has_mounted_branch ) {
14611432 // Restore previous fragment so that Svelte continues to operate in hydration mode
@@ -1469,14 +1440,15 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
14691440 block ,
14701441 true
14711442 ) ;
1443+ block . ce = consequent_effect ;
14721444 // Managed effect
14731445 const alternate_effect = render_effect (
14741446 ( ) => {
14751447 if ( alternate_dom !== null ) {
14761448 remove ( alternate_dom ) ;
14771449 alternate_dom = null ;
14781450 }
1479- if ( ! block . c ) {
1451+ if ( ! block . v ) {
14801452 if ( alternate_fn !== null ) {
14811453 alternate_fn ( anchor_node ) ;
14821454 }
@@ -1492,6 +1464,7 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
14921464 block ,
14931465 true
14941466 ) ;
1467+ block . ae = alternate_effect ;
14951468 push_destroy_fn ( if_effect , ( ) => {
14961469 if ( consequent_dom !== null ) {
14971470 remove ( consequent_dom ) ;
@@ -1676,7 +1649,6 @@ export function component(anchor_node, component_fn, render_fn) {
16761649 transitions . add ( transition ) ;
16771650 transition . f ( ( ) => {
16781651 transitions . delete ( transition ) ;
1679- remove_in_transitions ( transitions ) ;
16801652 if ( transitions . size === 0 ) {
16811653 if ( render . e !== null ) {
16821654 if ( render . d !== null ) {
@@ -1724,7 +1696,6 @@ export function component(anchor_node, component_fn, render_fn) {
17241696 return ;
17251697 }
17261698 const transitions = render . s ;
1727- remove_in_transitions ( transitions ) ;
17281699 if ( transitions . size === 0 ) {
17291700 if ( render . d !== null ) {
17301701 remove ( render . d ) ;
@@ -1804,7 +1775,6 @@ function await_block(anchor_node, input, pending_fn, then_fn, catch_fn) {
18041775 transitions . add ( transition ) ;
18051776 transition . f ( ( ) => {
18061777 transitions . delete ( transition ) ;
1807- remove_in_transitions ( transitions ) ;
18081778 if ( transitions . size === 0 ) {
18091779 if ( render . e !== null ) {
18101780 if ( render . d !== null ) {
@@ -1861,7 +1831,6 @@ function await_block(anchor_node, input, pending_fn, then_fn, catch_fn) {
18611831 return ;
18621832 }
18631833 const transitions = render . s ;
1864- remove_in_transitions ( transitions ) ;
18651834 if ( transitions . size === 0 ) {
18661835 if ( render . d !== null ) {
18671836 remove ( render . d ) ;
@@ -1966,7 +1935,6 @@ export function key(anchor_node, key, render_fn) {
19661935 transitions . add ( transition ) ;
19671936 transition . f ( ( ) => {
19681937 transitions . delete ( transition ) ;
1969- remove_in_transitions ( transitions ) ;
19701938 if ( transitions . size === 0 ) {
19711939 if ( render . e !== null ) {
19721940 if ( render . d !== null ) {
@@ -2007,7 +1975,6 @@ export function key(anchor_node, key, render_fn) {
20071975 return ;
20081976 }
20091977 const transitions = render . s ;
2010- remove_in_transitions ( transitions ) ;
20111978 if ( transitions . size === 0 ) {
20121979 if ( render . d !== null ) {
20131980 remove ( render . d ) ;
@@ -2195,7 +2162,6 @@ function each(anchor_node, collection, flags, key_fn, render_fn, fallback_fn, re
21952162 transitions . add ( transition ) ;
21962163 transition . f ( ( ) => {
21972164 transitions . delete ( transition ) ;
2198- remove_in_transitions ( transitions ) ;
21992165 if ( transitions . size === 0 ) {
22002166 if ( fallback . e !== null ) {
22012167 if ( fallback . d !== null ) {
0 commit comments