@ -90,18 +90,14 @@ export function set_active_effect(effect) {
/ * *
/ * *
* When sources are created within a reaction , reading and writing
* When sources are created within a reaction , reading and writing
* them within that reaction should not cause a re - run
* them within that reaction should not cause a re - run
* @ type { null | S ource[ ] }
* @ type { null | S et< Source > }
* /
* /
export let current _sources = null ;
export let current _sources = null ;
/** @param {Value} value */
/** @param {Value} value */
export function push _reaction _value ( value ) {
export function push _reaction _value ( value ) {
if ( active _reaction !== null && ( ! async _mode _flag || ( active _reaction . f & DERIVED ) !== 0 ) ) {
if ( active _reaction !== null && ( ! async _mode _flag || ( active _reaction . f & DERIVED ) !== 0 ) ) {
if ( current _sources === null ) {
( current _sources ? ? = new Set ( ) ) . add ( value ) ;
current _sources = [ value ] ;
} else {
current _sources . push ( value ) ;
}
}
}
}
}
@ -202,7 +198,7 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
var reactions = signal . reactions ;
var reactions = signal . reactions ;
if ( reactions === null ) return ;
if ( reactions === null ) return ;
if ( ! async _mode _flag && current _sources !== null && includes. call ( current _sources , signal ) ) {
if ( ! async _mode _flag && current _sources !== null && current_sources . has ( signal ) ) {
return ;
return ;
}
}
@ -540,7 +536,7 @@ export function get(signal) {
// we don't add the dependency, because that would create a memory leak
// we don't add the dependency, because that would create a memory leak
var destroyed = active _effect !== null && ( active _effect . f & DESTROYED ) !== 0 ;
var destroyed = active _effect !== null && ( active _effect . f & DESTROYED ) !== 0 ;
if ( ! destroyed && ( current _sources === null || ! includes. call ( current _sources , signal ) ) ) {
if ( ! destroyed && ( current _sources === null || ! current_sources . has ( signal ) ) ) {
var deps = active _reaction . deps ;
var deps = active _reaction . deps ;
if ( ( active _reaction . f & REACTION _IS _UPDATING ) !== 0 ) {
if ( ( active _reaction . f & REACTION _IS _UPDATING ) !== 0 ) {