|
|
|
|
@ -34,7 +34,7 @@ import { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';
|
|
|
|
|
import { Boundary } from '../dom/blocks/boundary.js';
|
|
|
|
|
import { component_context } from '../context.js';
|
|
|
|
|
import { UNINITIALIZED } from '../../../constants.js';
|
|
|
|
|
import { batch_values, current_batch, forked_derived_values } from './batch.js';
|
|
|
|
|
import { batch_values, current_batch } from './batch.js';
|
|
|
|
|
import { unset_context } from './async.js';
|
|
|
|
|
import { deferred } from '../../shared/utils.js';
|
|
|
|
|
|
|
|
|
|
@ -360,10 +360,8 @@ export function update_derived(derived) {
|
|
|
|
|
// the underlying value will be updated when the fork is committed.
|
|
|
|
|
// otherwise, the next time we get here after a 'real world' state
|
|
|
|
|
// change, `derived.equals` may incorrectly return `true`
|
|
|
|
|
if (!forked_derived_values) {
|
|
|
|
|
if (!current_batch?.is_fork) {
|
|
|
|
|
derived.v = value;
|
|
|
|
|
} else {
|
|
|
|
|
forked_derived_values.set(derived, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
derived.wv = increment_write_version();
|
|
|
|
|
@ -380,7 +378,7 @@ export function update_derived(derived) {
|
|
|
|
|
if (batch_values !== null) {
|
|
|
|
|
// only cache the value if we're in a tracking context, otherwise we won't
|
|
|
|
|
// clear the cache in `mark_reactions` when dependencies are updated
|
|
|
|
|
if (effect_tracking()) {
|
|
|
|
|
if (effect_tracking() || current_batch?.is_fork) {
|
|
|
|
|
batch_values.set(derived, value);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|