diff --git a/.changeset/sweet-bottles-check.md b/.changeset/sweet-bottles-check.md new file mode 100644 index 0000000000..fafab0f70f --- /dev/null +++ b/.changeset/sweet-bottles-check.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +chore: improve runtime performance of capturing reactive signals diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index b1f01ddcb6..c46acaa160 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -357,11 +357,7 @@ export function execute_reaction_fn(signal) { if (reactions === null) { dependency.reactions = [signal]; - } else if (reactions[reactions.length - 1] !== signal) { - // TODO: should this be: - // - // } else if (!reactions.includes(signal)) { - // + } else if (reactions[reactions.length - 1] !== signal && !reactions.includes(signal)) { reactions.push(signal); } }