|
|
@ -132,6 +132,8 @@ let write_version = 1;
|
|
|
|
/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
|
|
|
|
/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
|
|
|
|
let read_version = 0;
|
|
|
|
let read_version = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export let update_version = read_version;
|
|
|
|
|
|
|
|
|
|
|
|
// 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,
|
|
|
|
// to prevent memory leaks, we skip adding the reaction.
|
|
|
|
// to prevent memory leaks, we skip adding the reaction.
|
|
|
|
export let skip_reaction = false;
|
|
|
|
export let skip_reaction = false;
|
|
|
@ -265,6 +267,7 @@ export function update_reaction(reaction) {
|
|
|
|
var previous_reaction_sources = source_ownership;
|
|
|
|
var previous_reaction_sources = source_ownership;
|
|
|
|
var previous_component_context = component_context;
|
|
|
|
var previous_component_context = component_context;
|
|
|
|
var previous_untracking = untracking;
|
|
|
|
var previous_untracking = untracking;
|
|
|
|
|
|
|
|
var previous_update_version = update_version;
|
|
|
|
|
|
|
|
|
|
|
|
var flags = reaction.f;
|
|
|
|
var flags = reaction.f;
|
|
|
|
|
|
|
|
|
|
|
@ -278,7 +281,7 @@ export function update_reaction(reaction) {
|
|
|
|
source_ownership = null;
|
|
|
|
source_ownership = null;
|
|
|
|
set_component_context(reaction.ctx);
|
|
|
|
set_component_context(reaction.ctx);
|
|
|
|
untracking = false;
|
|
|
|
untracking = false;
|
|
|
|
read_version++;
|
|
|
|
update_version = ++read_version;
|
|
|
|
|
|
|
|
|
|
|
|
reaction.f |= EFFECT_IS_UPDATING;
|
|
|
|
reaction.f |= EFFECT_IS_UPDATING;
|
|
|
|
|
|
|
|
|
|
|
@ -366,6 +369,7 @@ export function update_reaction(reaction) {
|
|
|
|
source_ownership = previous_reaction_sources;
|
|
|
|
source_ownership = previous_reaction_sources;
|
|
|
|
set_component_context(previous_component_context);
|
|
|
|
set_component_context(previous_component_context);
|
|
|
|
untracking = previous_untracking;
|
|
|
|
untracking = previous_untracking;
|
|
|
|
|
|
|
|
update_version = previous_update_version;
|
|
|
|
|
|
|
|
|
|
|
|
reaction.f ^= EFFECT_IS_UPDATING;
|
|
|
|
reaction.f ^= EFFECT_IS_UPDATING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|