Skip to content

Commit 04eaf17

Browse files
authored
chore: improve signal runtime perf (#12093)
* chore: improve signal runtime perf * chore: improve signal runtime perf * chore: improve signal runtime perf
1 parent c7f6805 commit 04eaf17

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.changeset/sweet-bottles-check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
chore: improve runtime performance of capturing reactive signals

packages/svelte/src/internal/client/runtime.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,7 @@ export function execute_reaction_fn(signal) {
357357

358358
if (reactions === null) {
359359
dependency.reactions = [signal];
360-
} else if (reactions[reactions.length - 1] !== signal) {
361-
// TODO: should this be:
362-
//
363-
// } else if (!reactions.includes(signal)) {
364-
//
360+
} else if (reactions[reactions.length - 1] !== signal && !reactions.includes(signal)) {
365361
reactions.push(signal);
366362
}
367363
}

0 commit comments

Comments
 (0)