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 // traversal of the graph in the other batches still happens
if ( if (
batch_values !== null || batch_values !== null ||
(!current_batch && // "read outside of reactivity", e.g. in an event handler
first_batch?.next) /* means "read outside of reactivity, e.g. in an event hanlder" */ (!current_batch && first_batch?.next)
) { ) {
// only cache the value if we're in a tracking context, otherwise we won't // 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 // clear the cache in `mark_reactions` when dependencies are updated
if (effect_tracking() || current_batch?.is_fork) { if (effect_tracking() || current_batch?.is_fork) {
batch_values?.set(derived, value); 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); if (derived.v !== UNINITIALIZED) set_signal_status(derived, MAYBE_DIRTY);
} else { } else {
update_derived_status(derived); update_derived_status(derived);

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

Loading…
Cancel
Save