diff --git a/.changeset/flat-moose-arrive.md b/.changeset/flat-moose-arrive.md new file mode 100644 index 0000000000..0a8c229a66 --- /dev/null +++ b/.changeset/flat-moose-arrive.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: avoid extra work in mark_reactions diff --git a/packages/svelte/src/internal/client/reactivity/sources.js b/packages/svelte/src/internal/client/reactivity/sources.js index 86427a7509..772d62d026 100644 --- a/packages/svelte/src/internal/client/reactivity/sources.js +++ b/packages/svelte/src/internal/client/reactivity/sources.js @@ -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;