blockless
Rich Harris 10 months ago
parent 241622de6f
commit 3682c3e31c

@ -11,7 +11,7 @@ import {
ignore_mutation_validation, ignore_mutation_validation,
is_batching_effect, is_batching_effect,
is_runes, is_runes,
mark_signal_consumers, mark_signal_reactions,
schedule_effect, schedule_effect,
set_current_untracked_writes, set_current_untracked_writes,
set_last_inspected_signal, set_last_inspected_signal,
@ -122,7 +122,7 @@ export function set(signal, value) {
} }
} }
mark_signal_consumers(signal, DIRTY, true); mark_signal_reactions(signal, DIRTY, true);
// @ts-expect-error // @ts-expect-error
if (DEV && signal.inspect) { if (DEV && signal.inspect) {

@ -666,30 +666,30 @@ export async function tick() {
} }
/** /**
* @param {import('#client').Derived} signal * @param {import('#client').Derived} derived
* @param {boolean} force_schedule * @param {boolean} force_schedule
* @returns {void} * @returns {void}
*/ */
function update_derived(signal, force_schedule) { function update_derived(derived, force_schedule) {
const previous_updating_derived = updating_derived; const previous_updating_derived = updating_derived;
updating_derived = true; updating_derived = true;
const value = execute_reaction(signal); const value = execute_reaction(derived);
updating_derived = previous_updating_derived; updating_derived = previous_updating_derived;
const status = const status =
(current_skip_reaction || (signal.f & UNOWNED) !== 0) && signal.deps !== null (current_skip_reaction || (derived.f & UNOWNED) !== 0) && derived.deps !== null
? MAYBE_DIRTY ? MAYBE_DIRTY
: CLEAN; : CLEAN;
set_signal_status(signal, status); set_signal_status(derived, status);
if (!signal.eq(value, signal.v)) { if (!derived.eq(value, derived.v)) {
signal.v = value; derived.v = value;
mark_signal_consumers(signal, DIRTY, force_schedule); mark_signal_reactions(derived, DIRTY, force_schedule);
// @ts-expect-error // @ts-expect-error
if (DEV && signal.inspect && force_schedule) { if (DEV && derived.inspect && force_schedule) {
for (const fn of /** @type {import('#client').ValueDebug} */ (signal).inspect) fn(); for (const fn of /** @type {import('#client').ValueDebug} */ (derived).inspect) fn();
} }
} }
} }
@ -798,7 +798,7 @@ export function invalidate_inner_signals(fn) {
* @param {boolean} force_schedule * @param {boolean} force_schedule
* @returns {void} * @returns {void}
*/ */
export function mark_signal_consumers(signal, to_status, force_schedule) { export function mark_signal_reactions(signal, to_status, force_schedule) {
const runes = is_runes(null); const runes = is_runes(null);
const reactions = signal.reactions; const reactions = signal.reactions;
@ -829,7 +829,7 @@ export function mark_signal_consumers(signal, to_status, force_schedule) {
if ((flags & IS_EFFECT) !== 0) { if ((flags & IS_EFFECT) !== 0) {
schedule_effect(/** @type {import('#client').Effect} */ (reaction), false); schedule_effect(/** @type {import('#client').Effect} */ (reaction), false);
} else { } else {
mark_signal_consumers( mark_signal_reactions(
/** @type {import('#client').Value} */ (reaction), /** @type {import('#client').Value} */ (reaction),
MAYBE_DIRTY, MAYBE_DIRTY,
force_schedule force_schedule

Loading…
Cancel
Save