async-another-try
Simon Holthausen 5 days ago
parent 62fafd63ab
commit ddffe3efe2
No known key found for this signature in database

@ -457,16 +457,14 @@ export function update_derived(derived) {
// traversal of the graph in the other batches still happens
if (
batch_values !== null ||
(!current_batch &&
first_batch?.next) /* means "read outside of reactivity, e.g. in an event hanlder" */
// "read outside of reactivity", e.g. in an event handler
(!current_batch && first_batch?.next)
) {
// 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() || current_batch?.is_fork) {
batch_values?.set(derived, value);
}
// if (derived.v === value) set_signal_status(derived, MAYBE_DIRTY);
// if (!current_batch?.is_fork) set_signal_status(derived, MAYBE_DIRTY);
if (derived.v !== UNINITIALIZED) set_signal_status(derived, MAYBE_DIRTY);
} else {
update_derived_status(derived);

@ -38,7 +38,8 @@ import {
eager_block_effects,
schedule_effect,
legacy_updates,
current_batch
current_batch,
first_batch
} from './batch.js';
import { proxy } from '../proxy.js';
import { execute_derived } from './deriveds.js';
@ -207,8 +208,11 @@ export function internal_set(source, value, updated_during_traversal = null) {
// During time traveling we don't want to reset the status so that
// traversal of the graph in the other batches still happens
// TODO
if (batch_values === null) {
if (
batch_values === null &&
// could also be "read outside of reactivity", e.g. in an event handler
!first_batch?.next
) {
update_derived_status(derived);
}
}

Loading…
Cancel
Save