@ -149,8 +149,6 @@ export class Batch {
process ( root _effects ) {
queued _root _effects = [ ] ;
previous _batch = null ;
this . apply ( ) ;
/** @type {Effect[]} */
@ -168,14 +166,18 @@ export class Batch {
// log_inconsistent_branches(root);
}
if ( ! this . is _fork ) {
this . # resolve ( ) ;
}
if ( this . is _deferred ( ) ) {
this . # defer _effects ( render _effects ) ;
this . # defer _effects ( effects ) ;
} else {
// append/remove branches
for ( const fn of this . # commit _callbacks ) fn ( ) ;
this . # commit _callbacks . clear ( ) ;
if ( this . # pending === 0 ) {
this . # commit ( ) ;
}
// If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with
// newly updated sources, which could lead to infinite loops when effects run over and over again.
previous _batch = this ;
@ -328,18 +330,6 @@ export class Batch {
this . # discard _callbacks . clear ( ) ;
}
# resolve ( ) {
if ( this . # blocking _pending === 0 ) {
// append/remove branches
for ( const fn of this . # commit _callbacks ) fn ( ) ;
this . # commit _callbacks . clear ( ) ;
}
if ( this . # pending === 0 ) {
this . # commit ( ) ;
}
}
# commit ( ) {
// If there are other pending batches, they now need to be 'rebased' —
// in other words, we re-run block/async effects with the newly