Skip to content

Commit c419ab0

Browse files
committed
dont update derived status when time-travelling
1 parent 6912cd3 commit c419ab0

File tree

1 file changed

+8
-4
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+8
-4
lines changed

packages/svelte/src/internal/client/reactivity/deriveds.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { tracing_mode_flag } from '../../flags/index.js';
3333
import { Boundary } from '../dom/blocks/boundary.js';
3434
import { component_context } from '../context.js';
3535
import { UNINITIALIZED } from '../../../constants.js';
36-
import { current_batch } from './batch.js';
36+
import { batch_deriveds, current_batch } from './batch.js';
3737

3838
/** @type {Effect | null} */
3939
export let current_async_effect = null;
@@ -328,8 +328,12 @@ export function update_derived(derived) {
328328
// cleanup function, or it will cache a stale value
329329
if (is_destroying_effect) return;
330330

331-
var status =
332-
(skip_reaction || (derived.f & UNOWNED) !== 0) && derived.deps !== null ? MAYBE_DIRTY : CLEAN;
331+
if (batch_deriveds !== null) {
332+
batch_deriveds.set(derived, derived.v);
333+
} else {
334+
var status =
335+
(skip_reaction || (derived.f & UNOWNED) !== 0) && derived.deps !== null ? MAYBE_DIRTY : CLEAN;
333336

334-
set_signal_status(derived, status);
337+
set_signal_status(derived, status);
338+
}
335339
}

0 commit comments

Comments
 (0)