Skip to content

Commit

Permalink
fix: avoid extra work in mark_reactions (#12921)
Browse files Browse the repository at this point in the history
* fix: avoid extra work in mark_reactions

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

Co-authored-by: Rich Harris <[email protected]>

---------

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
trueadm and Rich-Harris authored Aug 20, 2024
1 parent a8c6b92 commit 4ce23bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-moose-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: avoid extra work in mark_reactions
4 changes: 2 additions & 2 deletions packages/svelte/src/internal/client/reactivity/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ function mark_reactions(signal, status) {
var reaction = reactions[i];
var flags = reaction.f;

// Skip any effects that are already dirty
if ((flags & DIRTY) !== 0) continue;
// If a reaction is already dirty, skip it (but always mark unowned deriveds)
if ((flags & (CLEAN | UNOWNED)) === 0) continue;

// In legacy mode, skip the current effect to prevent infinite loops
if (!runes && reaction === current_effect) continue;
Expand Down

0 comments on commit 4ce23bf

Please sign in to comment.