Skip to content

Commit 3e87bb3

Browse files
committed
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
1 parent 53417ea commit 3e87bb3

File tree

1 file changed

+4
-2
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+4
-2
lines changed

packages/svelte/src/internal/client/reactivity/sources.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,16 @@ function mark_reactions(signal, status) {
323323
continue;
324324
}
325325

326+
var not_dirty = (flags & DIRTY) === 0;
327+
326328
// don't set a DIRTY reaction to MAYBE_DIRTY
327-
if ((flags & DIRTY) === 0) {
329+
if (not_dirty) {
328330
set_signal_status(reaction, status);
329331
}
330332

331333
if ((flags & DERIVED) !== 0) {
332334
mark_reactions(/** @type {Derived} */ (reaction), MAYBE_DIRTY);
333-
} else {
335+
} else if (not_dirty) {
334336
schedule_effect(/** @type {Effect} */ (reaction));
335337
}
336338
}

0 commit comments

Comments
 (0)