|
|
|
@ -30,8 +30,6 @@ import { add_owner } from './dev/ownership.js';
|
|
|
|
import { mutate, set, source } from './reactivity/sources.js';
|
|
|
|
import { mutate, set, source } from './reactivity/sources.js';
|
|
|
|
import { destroy_derived } from './reactivity/deriveds.js';
|
|
|
|
import { destroy_derived } from './reactivity/deriveds.js';
|
|
|
|
|
|
|
|
|
|
|
|
const IS_EFFECT = EFFECT | PRE_EFFECT | RENDER_EFFECT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FLUSH_MICROTASK = 0;
|
|
|
|
const FLUSH_MICROTASK = 0;
|
|
|
|
const FLUSH_SYNC = 1;
|
|
|
|
const FLUSH_SYNC = 1;
|
|
|
|
|
|
|
|
|
|
|
|
@ -852,36 +850,40 @@ export function mark_subtree_inert(signal, inert, visited_blocks = new Set()) {
|
|
|
|
* @returns {void}
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function mark_reactions(signal, to_status, force_schedule) {
|
|
|
|
export function mark_reactions(signal, to_status, force_schedule) {
|
|
|
|
const runes = is_runes();
|
|
|
|
var reactions = signal.reactions;
|
|
|
|
const reactions = signal.reactions;
|
|
|
|
if (reactions === null) return;
|
|
|
|
if (reactions !== null) {
|
|
|
|
|
|
|
|
const length = reactions.length;
|
|
|
|
var runes = is_runes();
|
|
|
|
let i;
|
|
|
|
var length = reactions.length;
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
|
|
|
|
const reaction = reactions[i];
|
|
|
|
for (var i = 0; i < length; i++) {
|
|
|
|
const flags = reaction.f;
|
|
|
|
var reaction = reactions[i];
|
|
|
|
const unowned = (flags & UNOWNED) !== 0;
|
|
|
|
|
|
|
|
// We skip any effects that are already dirty (but not unowned). Additionally, we also
|
|
|
|
// We skip any effects that are already dirty (but not unowned). Additionally, we also
|
|
|
|
// skip if the reaction is the same as the current effect (except if we're not in runes or we
|
|
|
|
// skip if the reaction is the same as the current effect (except if we're not in runes or we
|
|
|
|
// are in force schedule mode).
|
|
|
|
// are in force schedule mode).
|
|
|
|
if ((!force_schedule || !runes) && reaction === current_effect) {
|
|
|
|
if ((!force_schedule || !runes) && reaction === current_effect) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var flags = reaction.f;
|
|
|
|
set_signal_status(reaction, to_status);
|
|
|
|
set_signal_status(reaction, to_status);
|
|
|
|
|
|
|
|
|
|
|
|
// If the signal is not clean, then skip over it – with the exception of unowned signals that
|
|
|
|
// If the signal is not clean, then skip over it – with the exception of unowned signals that
|
|
|
|
// are already maybe dirty. Unowned signals might be dirty because they are not captured as part of an
|
|
|
|
// are already maybe dirty. Unowned signals might be dirty because they are not captured as part of an
|
|
|
|
// effect.
|
|
|
|
// effect.
|
|
|
|
const maybe_dirty = (flags & MAYBE_DIRTY) !== 0;
|
|
|
|
var maybe_dirty = (flags & MAYBE_DIRTY) !== 0;
|
|
|
|
|
|
|
|
var unowned = (flags & UNOWNED) !== 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((flags & CLEAN) !== 0 || (maybe_dirty && unowned)) {
|
|
|
|
if ((flags & CLEAN) !== 0 || (maybe_dirty && unowned)) {
|
|
|
|
if ((reaction.f & IS_EFFECT) !== 0) {
|
|
|
|
if ((reaction.f & DERIVED) !== 0) {
|
|
|
|
schedule_effect(/** @type {import('#client').Effect} */ (reaction), false);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mark_reactions(
|
|
|
|
mark_reactions(
|
|
|
|
/** @type {import('#client').Derived} */ (reaction),
|
|
|
|
/** @type {import('#client').Derived} */ (reaction),
|
|
|
|
MAYBE_DIRTY,
|
|
|
|
MAYBE_DIRTY,
|
|
|
|
force_schedule
|
|
|
|
force_schedule
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
schedule_effect(/** @type {import('#client').Effect} */ (reaction), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|