diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index ff8198adb4..67839f71a6 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -226,7 +226,11 @@ export class Batch { maybe_dirty_effects = new Set(); /** - * Deferred derived effects that are DIRTY + * Deferred deriveds that are DIRTY. We need to store these because a derived that definitely should execute + * might get executed in the meantime in another batch (they are lazy, so a DIRTY derived is not guaranteed + * to run immediately). Relying on wv_values is insufficient because if this derived has stale dependencies + * in this batch but is executed with latest dependencies elsewhere, the wv is bumped and would incorrectly + * say "hey we don't need to rerun this" in the context of this batch. * @type {Set} */ #dirty_deriveds = new Set(); diff --git a/packages/svelte/src/internal/client/reactivity/sources.js b/packages/svelte/src/internal/client/reactivity/sources.js index 746aed25ae..b001702093 100644 --- a/packages/svelte/src/internal/client/reactivity/sources.js +++ b/packages/svelte/src/internal/client/reactivity/sources.js @@ -416,7 +416,6 @@ function mark_reactions(signal, status, updated_during_traversal) { } else if ((flags & DERIVED) !== 0) { var derived = /** @type {Derived} */ (reaction); - batch_values?.delete(derived); mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal); } else if (not_dirty) { var effect = /** @type {Effect} */ (reaction);