fix: ensure $inspect.trace indicated dirty traced deps correctly

fix-inspect-trace
Dominic Gannaway 4 days ago
parent 1d773ef3a4
commit 49013d7bfa

@ -528,6 +528,22 @@ export function update_effect(effect) {
effect.teardown = typeof teardown === 'function' ? teardown : null;
effect.version = current_version;
var version = current_version;
var deps = effect.deps;
// In DEV, we need to handle a case where $inspect.trace() might
// incorrectly state a source dependency has not changed when it has.
// That's beacuse that source was changed by the same effect, causing
// the versions to match. We can avoid this by incrementing the version
if (DEV && (effect.f & DIRTY) !== 0 && deps !== null) {
for (let i = 0; i < deps.length; i++) {
var dep = deps[i];
if ((dep.f & DERIVED) === 0 && dep.version === version) {
dep.version = increment_version();
}
}
}
if (DEV) {
dev_effect_stack.push(effect);
}

Loading…
Cancel
Save