don't bail self-invalidation in async mode + don't mark reactions on initial run

not marking without not bailing makes two tests fail, revealing that the "don't self-invalidate in async mode" change would actually be a subtle breaking change
incremental-batches-perf-attempt
Simon Holthausen 2 months ago
parent b199a7ea90
commit 4866aa2333
No known key found for this signature in database

@ -287,18 +287,20 @@ export class Batch {
if (this.#committed) return;
current_batch = this;
this.#started = true;
if (flush_count++ > 1000) {
this.#unlink();
infinite_loop_guard();
}
// TODO we only need to do this for re-runs
for (const [source, snapshot] of this.current) {
mark_reactions(this, source, snapshot.wv, null);
if (this.#started) {
for (const [source, snapshot] of this.current) {
mark_reactions(this, source, snapshot.wv, null);
}
}
this.#started = true;
if (DEV) {
// track all the values that were updated during this flush,
// so that they can be reset afterwards

@ -1,6 +1,5 @@
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
/** @import { Derived, Effect, Source, Value } from '#client' */
/** @import { Batch } from './batch.js'; */
/** @import { Boundary } from '../dom/blocks/boundary.js'; */
import { DEV } from 'esm-env';
import {
ERROR_VALUE,
@ -26,14 +25,13 @@ import {
write_version,
skipped_deps,
new_deps,
is_destroying_effect,
current_sources
is_destroying_effect
} from '../runtime.js';
import { equals, safe_equals } from './equality.js';
import * as e from '../errors.js';
import * as w from '../warnings.js';
import { async_effect, destroy_effect, destroy_effect_children, teardown } from './effects.js';
import { eager_effects, internal_set, set_eager_effects, source, state } from './sources.js';
import { eager_effects, internal_set, set_eager_effects, state } from './sources.js';
import { get_error } from '../../shared/dev.js';
import { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';
import { component_context } from '../context.js';

@ -300,7 +300,6 @@ export function update_reaction(reaction) {
// ensure that if any of those untracked writes result in re-invalidation
// of the current effect, then that happens accordingly
if (
!async_mode_flag &&
is_runes() &&
untracked_writes !== null &&
!untracking &&

Loading…
Cancel
Save