pull/16197/head
Rich Harris 6 months ago
parent 6e26478a17
commit 5518e98c31

@ -1,7 +1,6 @@
/** @import { Effect, Source } from '#client' */
import { DIRTY } from '#client/constants';
import { noop } from '../../shared/utils.js';
import { flushSync } from '../runtime.js';
import { schedule_effect, set_signal_status } from '../runtime.js';
import { raf } from '../timing.js';
import { internal_set, mark_reactions, pending } from './sources.js';
@ -31,6 +30,9 @@ export class Batch {
/** @type {Map<Source, any>} */
#current = new Map();
/** @type {Set<Effect>} */
effects = new Set();
/** @type {Set<Effect>} */
skipped_effects = new Set();
@ -49,6 +51,13 @@ export class Batch {
source.v = current;
}
for (const e of this.effects) {
if (e.fn) {
set_signal_status(e, DIRTY);
schedule_effect(e);
}
}
for (const batch of batches) {
if (batch === this) continue;

@ -718,6 +718,18 @@ function flush_queued_root_effects() {
batch.commit();
flush_queued_effects(render_effects);
flush_queued_effects(effects);
} else {
// store the effects on the batch so that they run next time,
// even if they don't get re-dirtied
for (const e of render_effects) {
batch.effects.add(e);
set_signal_status(e, CLEAN);
}
for (const e of effects) {
batch.effects.add(e);
set_signal_status(e, CLEAN);
}
}
revert();

Loading…
Cancel
Save