fix: ensure unowned deriveds correctly get re-linked to the graph

pull/14855/head
Dominic Gannaway 2 years ago
parent 7f8acb8a37
commit 9285e7b1d3

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure unowned deriveds correctly get re-linked to the graph

@ -205,10 +205,12 @@ export function check_dirtiness(reaction) {
reaction.f ^= DISCONNECTED;
}
var dirty = false;
for (i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (check_dirtiness(/** @type {Derived} */ (dependency))) {
if (!dirty && check_dirtiness(/** @type {Derived} */ (dependency))) {
update_derived(/** @type {Derived} */ (dependency));
}
@ -225,9 +227,15 @@ export function check_dirtiness(reaction) {
}
if (dependency.version > reaction.version) {
return true;
// We can't just return here as we might have other dependencies that are unowned
// ad need to be linked to the reaction again
dirty = true;
}
}
if (dirty) {
return true;
}
}
// Unowned signals should never be marked as clean unless they

Loading…
Cancel
Save