Skip to content

Commit 0168c34

Browse files
committed
fix: reset dependency read versions after reaction execution
1 parent b6669fa commit 0168c34

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,12 @@ export function update_reaction(reaction) {
429429
if (!skip_reaction) {
430430
(dep.reactions ??= []).push(reaction);
431431
}
432-
// Reset read version back to 0, otherwise if we are
433-
// returning to an existing reaction from before then
434-
// and it uses this depedency too then it will be the
435-
// same read version as the current global read version
436-
// and not correctly be added as a dependency
432+
// Reset read version back to 0. If we are
433+
// returning to an previous reaction and
434+
// it were to read this depedency too and we
435+
// didn't reset the read version, then it would
436+
// not be added as a dependency to that reaction
437+
// as the global read version won't have changed
437438
dep.rv = 0;
438439
}
439440
} else if (deps !== null && skipped_deps < deps.length) {

0 commit comments

Comments
 (0)