diff --git a/.changeset/many-worms-attend.md b/.changeset/many-worms-attend.md new file mode 100644 index 000000000000..0da3699967f6 --- /dev/null +++ b/.changeset/many-worms-attend.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: improve unowned derived performance diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index ff8eaa8ef9bc..27e174d3aa73 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -230,8 +230,9 @@ export function check_dirtiness(reaction) { } } - // Unowned signals should never be marked as clean. - if (!is_unowned) { + // Unowned signals should never be marked as clean unless they + // are used within an active_effect without skip_reaction + if (!is_unowned || (active_effect !== null && !skip_reaction)) { set_signal_status(reaction, CLEAN); } }