diff --git a/packages/svelte/src/internal/client/reactivity/forks.js b/packages/svelte/src/internal/client/reactivity/forks.js index f450d215f9..7f306aff55 100644 --- a/packages/svelte/src/internal/client/reactivity/forks.js +++ b/packages/svelte/src/internal/client/reactivity/forks.js @@ -1,6 +1,7 @@ /** @import { Effect, Source } from '#client' */ +import { DIRTY } from '../constants.js'; import { flush_sync } from '../runtime.js'; -import { internal_set } from './sources.js'; +import { internal_set, mark_reactions } from './sources.js'; /** @type {Set} */ const forks = new Set(); @@ -28,26 +29,26 @@ export class Fork { var values = new Map(); for (const source of this.previous.keys()) { + // mark_reactions(source, DIRTY); values.set(source, source.v); } + for (const [source, current] of this.current) { + source.v = current; + } + for (const fork of forks) { if (fork === this) continue; for (const [source, previous] of fork.previous) { if (!values.has(source)) { + // mark_reactions(source, DIRTY); values.set(source, source.v); - // internal_set(source, previous); source.v = previous; } } } - for (const [source, current] of this.current) { - source.v = current; - // internal_set(source, current); - } - return () => { for (const [source, value] of values) { source.v = value;