async-changeset
Rich Harris 7 months ago
parent df027d0f34
commit c2c17f6b0c

@ -44,6 +44,9 @@ export function set_inspect_effects(v) {
inspect_effects = v; inspect_effects = v;
} }
/** @type {Set<Source>} */
export const changeset = new Set();
/** /**
* @template V * @template V
* @param {V} v * @param {V} v
@ -181,6 +184,10 @@ export function internal_set(source, value) {
} }
} }
if (!changeset.has(source)) {
changeset.add(source);
}
mark_reactions(source, DIRTY); mark_reactions(source, DIRTY);
// It's possible that the current reaction might not have up-to-date dependencies // It's possible that the current reaction might not have up-to-date dependencies

@ -31,7 +31,7 @@ import {
flush_boundary_micro_tasks, flush_boundary_micro_tasks,
flush_post_micro_tasks flush_post_micro_tasks
} from './dom/task.js'; } from './dom/task.js';
import { internal_set } from './reactivity/sources.js'; import { changeset, internal_set } from './reactivity/sources.js';
import { import {
destroy_derived_effects, destroy_derived_effects,
from_async_derived, from_async_derived,
@ -705,6 +705,7 @@ function flush_queued_root_effects(root_effects) {
} }
} finally { } finally {
is_flushing_effect = previously_flushing_effect; is_flushing_effect = previously_flushing_effect;
changeset.clear();
} }
} }
@ -825,6 +826,8 @@ function process_effects(effect, collected_effects, boundary) {
} else if ((flags & BOUNDARY_EFFECT) !== 0) { } else if ((flags & BOUNDARY_EFFECT) !== 0) {
var b = /** @type {Boundary} */ (current_effect.b); var b = /** @type {Boundary} */ (current_effect.b);
console.log([...changeset].map((s) => s.v));
process_effects(current_effect, collected_effects, b); process_effects(current_effect, collected_effects, b);
if (!b.suspended) { if (!b.suspended) {

Loading…
Cancel
Save