@ -63,11 +63,6 @@ export function set_is_destroying_effect(value) {
is _destroying _effect = value ;
is _destroying _effect = value ;
}
}
/** @param {boolean} value */
export function set _untracking ( value ) {
current _untracking = value ;
}
// Used for $inspect
// Used for $inspect
export let is _batching _effect = false ;
export let is _batching _effect = false ;
let is _inspecting _signal = false ;
let is _inspecting _signal = false ;
@ -119,10 +114,7 @@ export function set_last_inspected_signal(signal) {
last _inspected _signal = signal ;
last _inspected _signal = signal ;
}
}
/** If `true`, `get`ting the signal should not register it as a dependency */
/** @type {number} Used by sources and deriveds for handling updates to unowned deriveds */
export let current _untracking = false ;
/** @type {number} */
let current _version = 0 ;
let current _version = 0 ;
// If we are working with a get() chain that has no active container,
// If we are working with a get() chain that has no active container,
@ -351,14 +343,12 @@ export function execute_reaction_fn(signal) {
const previous _untracked _writes = current _untracked _writes ;
const previous _untracked _writes = current _untracked _writes ;
const previous _reaction = current _reaction ;
const previous _reaction = current _reaction ;
const previous _skip _reaction = current _skip _reaction ;
const previous _skip _reaction = current _skip _reaction ;
const previous _untracking = current _untracking ;
current _dependencies = /** @type {null | import('#client').Value[]} */ ( null ) ;
current _dependencies = /** @type {null | import('#client').Value[]} */ ( null ) ;
current _dependencies _index = 0 ;
current _dependencies _index = 0 ;
current _untracked _writes = null ;
current _untracked _writes = null ;
current _reaction = signa l;
current _reaction = ( signa l. f & ( BRANCH _EFFECT | ROOT _EFFECT ) ) === 0 ? signal : nul l;
current _skip _reaction = ! is _flushing _effect && ( signal . f & UNOWNED ) !== 0 ;
current _skip _reaction = ! is _flushing _effect && ( signal . f & UNOWNED ) !== 0 ;
current _untracking = false ;
try {
try {
let res = /** @type {Function} */ ( 0 , signal . fn ) ( ) ;
let res = /** @type {Function} */ ( 0 , signal . fn ) ( ) ;
@ -429,7 +419,6 @@ export function execute_reaction_fn(signal) {
current _untracked _writes = previous _untracked _writes ;
current _untracked _writes = previous _untracked _writes ;
current _reaction = previous _reaction ;
current _reaction = previous _reaction ;
current _skip _reaction = previous _skip _reaction ;
current _skip _reaction = previous _skip _reaction ;
current _untracking = previous _untracking ;
}
}
}
}
@ -820,11 +809,7 @@ export function get(signal) {
}
}
// Register the dependency on the current reaction signal.
// Register the dependency on the current reaction signal.
if (
if ( current _reaction !== null ) {
current _reaction !== null &&
( current _reaction . f & ( BRANCH _EFFECT | ROOT _EFFECT ) ) === 0 &&
! current _untracking
) {
const unowned = ( current _reaction . f & UNOWNED ) !== 0 ;
const unowned = ( current _reaction . f & UNOWNED ) !== 0 ;
const dependencies = current _reaction . deps ;
const dependencies = current _reaction . deps ;
if (
if (
@ -967,12 +952,12 @@ export function mark_reactions(signal, to_status, force_schedule) {
* @ returns { T }
* @ returns { T }
* /
* /
export function untrack ( fn ) {
export function untrack ( fn ) {
const previous _ untracking = current _untracking ;
const previous _ reaction = current _reaction ;
try {
try {
current _ untracking = true ;
current _ reaction = null ;
return fn ( ) ;
return fn ( ) ;
} finally {
} finally {
current _ untracking = previous _untracking ;
current _ reaction = previous _reaction ;
}
}
}
}