chore: don't do effect scheduling unnecessarily

mini-cleanup post #16487 - we don't need to do the work of scheduling an effect that's already dirty which means it already scheduled its root effect to run
pull/16489/head
Simon Holthausen 1 month ago
parent 53417ea8f7
commit 3e87bb3a20

@ -323,14 +323,16 @@ function mark_reactions(signal, status) {
continue; continue;
} }
var not_dirty = (flags & DIRTY) === 0;
// don't set a DIRTY reaction to MAYBE_DIRTY // don't set a DIRTY reaction to MAYBE_DIRTY
if ((flags & DIRTY) === 0) { if (not_dirty) {
set_signal_status(reaction, status); set_signal_status(reaction, status);
} }
if ((flags & DERIVED) !== 0) { if ((flags & DERIVED) !== 0) {
mark_reactions(/** @type {Derived} */ (reaction), MAYBE_DIRTY); mark_reactions(/** @type {Derived} */ (reaction), MAYBE_DIRTY);
} else { } else if (not_dirty) {
schedule_effect(/** @type {Effect} */ (reaction)); schedule_effect(/** @type {Effect} */ (reaction));
} }
} }

Loading…
Cancel
Save