@ -387,22 +387,12 @@ export class Batch {
if ( this . is _fork ) return true ;
if ( this . is _fork ) return true ;
if ( this . # blocking _pending === null ) return false ;
if ( this . # blocking _pending === null ) return false ;
for ( const effect of this . # blocking _pending . keys ( ) ) {
for ( let e of this . # blocking _pending . keys ( ) ) {
var e = effect ;
// pending work inside a skipped branch doesn't block, the branch is going to be destroyed
var skipped = false ;
while ( e . parent !== null && ! this . # skipped _branches . has ( e ) ) {
while ( e . parent !== null ) {
if ( this . # skipped _branches . has ( e ) ) {
skipped = true ;
break ;
}
e = e . parent ;
e = e . parent ;
}
}
if ( e . parent === null ) return true ;
if ( ! skipped ) {
return true ;
}
}
}
return false ;
return false ;
@ -786,9 +776,6 @@ export class Batch {
? ! this . seen _effects ? . has ( effect ) && ! this . # dirty _reactions . has ( effect )
? ! this . seen _effects ? . has ( effect ) && ! this . # dirty _reactions . has ( effect )
: ( flags & ( ASYNC | BLOCK _EFFECT ) ) === 0 || this . seen _effects ? . has ( effect )
: ( flags & ( ASYNC | BLOCK _EFFECT ) ) === 0 || this . seen _effects ? . has ( effect )
) {
) {
if ( this . # dirty _reactions . get ( effect ) === MAYBE _DIRTY ) {
this . # dirty _reactions . delete ( effect ) ;
}
this . schedule ( effect , status ) ;
this . schedule ( effect , status ) ;
marked = true ;
marked = true ;
}
}
@ -949,7 +936,7 @@ export class Batch {
// so comparing what was read against the real value could not attribute the value to the right
// so comparing what was read against the real value could not attribute the value to the right
// batch, see `async-dont-rebase-new-batch-4`. We only need to look one level deep: `is_dirty`
// batch, see `async-dont-rebase-new-batch-4`. We only need to look one level deep: `is_dirty`
// evaluates the top-most deriveds first, so a dependency derived that was itself not the latest
// evaluates the top-most deriveds first, so a dependency derived that was itself not the latest
// value was not written to the real world, and differs from our value for it .
// value was not written to the real world, which the check above already catches .
for ( let batch = this . next ; batch !== null && is _latest _value ; batch = batch . next ) {
for ( let batch = this . next ; batch !== null && is _latest _value ; batch = batch . next ) {
if ( batch . is _fork ) continue ;
if ( batch . is _fork ) continue ;
@ -957,10 +944,8 @@ export class Batch {
if (
if (
batch . current . has ( source ) ||
batch . current . has ( source ) ||
( ( source . f & DERIVED ) !== 0 &&
( ( source . f & DERIVED ) !== 0 &&
/** @type {Derived} */ ( source ) . deps ? . some (
/** @type {Derived} */ ( source ) . deps ? . some ( ( d ) =>
( d ) =>
/** @type {Batch} */ ( batch ) . current . has ( d )
/** @type {Batch} */ ( batch ) . current . has ( d ) ||
( this . current . has ( d ) && /** @type {{ v: any }} */ ( this . current . get ( d ) ) . v !== d . v )
) )
) )
) {
) {
is _latest _value = false ;
is _latest _value = false ;
@ -1018,7 +1003,9 @@ export class Batch {
) {
) {
if ( current !== undefined ) this . current . set ( source , current ) ;
if ( current !== undefined ) this . current . set ( source , current ) ;
} else {
} else {
this . queue _revalidation ( source ) ;
queue _micro _task ( ( ) => {
if ( this . linked && this . mark ( source , DIRTY ) ) this . flush ( ) ;
} ) ;
}
}
}
}
}
}
@ -1042,15 +1029,6 @@ export class Batch {
} ) ;
} ) ;
}
}
/** @param {Value} source */
queue _revalidation ( source ) {
queue _micro _task ( ( ) => {
if ( this . linked && this . mark ( source , DIRTY ) ) {
this . flush ( ) ;
}
} ) ;
}
/ * *
/ * *
* Activate batch - could be merged into another batch in the meantime ,
* Activate batch - could be merged into another batch in the meantime ,
* in which case that other batch becomes the active batch .
* in which case that other batch becomes the active batch .