@@ -292,12 +292,12 @@ export class Batch {
292292 if ( ! skip && effect . fn !== null ) {
293293 if ( is_branch ) {
294294 effect . f ^= CLEAN ;
295+ } else if ( ( flags & EFFECT ) !== 0 ) {
296+ this . #effects. push ( effect ) ;
297+ } else if ( async_mode_flag && ( flags & RENDER_EFFECT ) !== 0 ) {
298+ this . #render_effects. push ( effect ) ;
295299 } else if ( ( flags & CLEAN ) === 0 ) {
296- if ( ( flags & EFFECT ) !== 0 ) {
297- this . #effects. push ( effect ) ;
298- } else if ( async_mode_flag && ( flags & RENDER_EFFECT ) !== 0 ) {
299- this . #render_effects. push ( effect ) ;
300- } else if ( ( flags & ASYNC ) !== 0 ) {
300+ if ( ( flags & ASYNC ) !== 0 ) {
301301 var effects = effect . b ?. pending ? this . #boundary_async_effects : this . #async_effects;
302302 effects . push ( effect ) ;
303303 } else if ( is_dirty ( effect ) ) {
@@ -584,6 +584,9 @@ function infinite_loop_guard() {
584584 }
585585}
586586
587+ /** @type {Effect[] | null } */
588+ export let eager_block_effects = null ;
589+
587590/**
588591 * @param {Array<Effect> } effects
589592 * @returns {void }
@@ -598,7 +601,7 @@ function flush_queued_effects(effects) {
598601 var effect = effects [ i ++ ] ;
599602
600603 if ( ( effect . f & ( DESTROYED | INERT ) ) === 0 && is_dirty ( effect ) ) {
601- var n = current_batch ? current_batch . current . size : 0 ;
604+ eager_block_effects = [ ] ;
602605
603606 update_effect ( effect ) ;
604607
@@ -619,21 +622,20 @@ function flush_queued_effects(effects) {
619622 }
620623 }
621624
622- // if state is written in a user effect, abort and re-schedule, lest we run
623- // effects that should be removed as a result of the state change
624- if (
625- current_batch !== null &&
626- current_batch . current . size > n &&
627- ( effect . f & USER_EFFECT ) !== 0
628- ) {
629- break ;
625+ if ( eager_block_effects . length > 0 ) {
626+ // TODO this feels incorrect! it gets the tests passing
627+ old_values . clear ( ) ;
628+
629+ for ( const e of eager_block_effects ) {
630+ update_effect ( e ) ;
631+ }
632+
633+ eager_block_effects = [ ] ;
630634 }
631635 }
632636 }
633637
634- while ( i < length ) {
635- schedule_effect ( effects [ i ++ ] ) ;
636- }
638+ eager_block_effects = null ;
637639}
638640
639641/**
0 commit comments