Skip to content

Commit 3f8c7dd

Browse files
committed
cleaner apporach
1 parent 3ec6bc6 commit 3f8c7dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ export function check_dirtiness(reaction) {
199199
var dependency;
200200
var is_disconnected = (flags & DISCONNECTED) !== 0;
201201
var is_unowned_connected = is_unowned && active_effect !== null && !skip_reaction;
202+
var length = dependencies.length;
202203

203204
// If we are working with a disconnected or an unowned signal that is now connected (due to an active effect)
204205
// then we need to re-connect the reaction to the dependency
205206
if (is_disconnected || is_unowned_connected) {
206-
for (i = 0; i < dependencies.length; i++) {
207+
for (i = 0; i < length; i++) {
207208
dependency = dependencies[i];
208209

209210
if (!dependency?.reactions?.includes(reaction)) {
@@ -216,7 +217,7 @@ export function check_dirtiness(reaction) {
216217
}
217218
}
218219

219-
for (i = 0; i < dependencies.length; i++) {
220+
for (i = 0; i < length; i++) {
220221
dependency = dependencies[i];
221222

222223
if (check_dirtiness(/** @type {Derived} */ (dependency))) {

0 commit comments

Comments
 (0)