|
|
|
@ -184,19 +184,29 @@ export function check_dirtiness(reaction) {
|
|
|
|
// If we are working with a disconnected or an unowned signal that is now connected (due to an active effect)
|
|
|
|
// If we are working with a disconnected or an unowned signal that is now connected (due to an active effect)
|
|
|
|
// then we need to re-connect the reaction to the dependency
|
|
|
|
// then we need to re-connect the reaction to the dependency
|
|
|
|
if (is_disconnected || is_unowned_connected) {
|
|
|
|
if (is_disconnected || is_unowned_connected) {
|
|
|
|
|
|
|
|
var derived = /** @type {Derived} */ (reaction);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
dependency = dependencies[i];
|
|
|
|
dependency = dependencies[i];
|
|
|
|
|
|
|
|
|
|
|
|
// We always re-add all reactions (even duplicates) if the derived was
|
|
|
|
// We always re-add all reactions (even duplicates) if the derived was
|
|
|
|
// previously disconnected, however we don't if it was unowned as we
|
|
|
|
// previously disconnected, however we don't if it was unowned as we
|
|
|
|
// de-duplicate dependencies in that case
|
|
|
|
// de-duplicate dependencies in that case
|
|
|
|
if (is_disconnected || !dependency?.reactions?.includes(reaction)) {
|
|
|
|
if (is_disconnected || !dependency?.reactions?.includes(derived)) {
|
|
|
|
(dependency.reactions ??= []).push(reaction);
|
|
|
|
(dependency.reactions ??= []).push(derived);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (is_disconnected) {
|
|
|
|
if (is_disconnected) {
|
|
|
|
reaction.f ^= DISCONNECTED;
|
|
|
|
derived.f ^= DISCONNECTED;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var parent = derived.parent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_unowned_connected && parent !== null && (parent.f & UNOWNED) === 0) {
|
|
|
|
|
|
|
|
// If the derived is owned by another derived then mark it as owned agaub
|
|
|
|
|
|
|
|
// as the derived value might have been referenced in a different context
|
|
|
|
|
|
|
|
// and now has a reacive context managing it
|
|
|
|
|
|
|
|
derived.f ^= UNOWNED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -409,6 +419,10 @@ export function update_reaction(reaction) {
|
|
|
|
(flags & UNOWNED) !== 0 &&
|
|
|
|
(flags & UNOWNED) !== 0 &&
|
|
|
|
(!is_flushing_effect || previous_reaction === null || previous_untracking);
|
|
|
|
(!is_flushing_effect || previous_reaction === null || previous_untracking);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (skip_reaction) {
|
|
|
|
|
|
|
|
// debugger
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
derived_sources = null;
|
|
|
|
derived_sources = null;
|
|
|
|
set_component_context(reaction.ctx);
|
|
|
|
set_component_context(reaction.ctx);
|
|
|
|
untracking = false;
|
|
|
|
untracking = false;
|
|
|
|
|