File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -703,18 +703,18 @@ export function schedule_effect(signal) {
703703 queued_root_effects . push ( effect ) ;
704704}
705705
706- /** @type {Source<number>[] | null } */
707- let eager_flushing = null ;
706+ /** @type {Source<number>[] } */
707+ let eager_versions = [ ] ;
708708
709709function eager_flush ( ) {
710710 try {
711711 flushSync ( ( ) => {
712- /** @type { Source<number>[] } */ ( eager_flushing ) . forEach ( ( version ) => {
712+ for ( const version of eager_versions ) {
713713 update ( version ) ;
714- } ) ;
714+ }
715715 } ) ;
716716 } finally {
717- eager_flushing = null ;
717+ eager_versions = [ ] ;
718718 }
719719}
720720
@@ -750,11 +750,11 @@ export function eager(fn) {
750750 // the second time this effect runs, it's to schedule a
751751 // `version` update. since this will recreate the effect,
752752 // we don't need to evaluate the expression here
753- if ( ! eager_flushing ) {
754- eager_flushing = [ ] ;
753+ if ( eager_versions . length === 0 ) {
755754 queue_micro_task ( eager_flush ) ;
756755 }
757- eager_flushing . push ( version ) ;
756+
757+ eager_versions . push ( version ) ;
758758 } ) ;
759759
760760 initial = false ;
You can’t perform that action at this time.
0 commit comments