Skip to content

Commit

Permalink
chore: improve signal runtime perf (#12093)
Browse files Browse the repository at this point in the history
* chore: improve signal runtime perf

* chore: improve signal runtime perf

* chore: improve signal runtime perf
  • Loading branch information
trueadm authored Jun 19, 2024
1 parent c7f6805 commit 04eaf17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-bottles-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte": patch
---

chore: improve runtime performance of capturing reactive signals
6 changes: 1 addition & 5 deletions packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 04eaf17

Please sign in to comment.