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

@ -11,7 +11,7 @@ import {
ignore_mutation_validation,
is_batching_effect,
is_runes,
mark_signal_consumers,
mark_signal_reactions,
schedule_effect,
set_current_untracked_writes,
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
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
* @returns {void}
*/
function update_derived(signal, force_schedule) {
function update_derived(derived, force_schedule) {
const previous_updating_derived = updating_derived;
updating_derived = true;
const value = execute_reaction(signal);
const value = execute_reaction(derived);
updating_derived = previous_updating_derived;
const status =
(current_skip_reaction || (signal.f & UNOWNED) !== 0) && signal.deps !== null
(current_skip_reaction || (derived.f & UNOWNED) !== 0) && derived.deps !== null
? MAYBE_DIRTY
: CLEAN;
set_signal_status(signal, status);
set_signal_status(derived, status);
if (!signal.eq(value, signal.v)) {
signal.v = value;
mark_signal_consumers(signal, DIRTY, force_schedule);
if (!derived.eq(value, derived.v)) {
derived.v = value;
mark_signal_reactions(derived, DIRTY, force_schedule);
// @ts-expect-error
if (DEV && signal.inspect && force_schedule) {
for (const fn of /** @type {import('#client').ValueDebug} */ (signal).inspect) fn();
if (DEV && derived.inspect && force_schedule) {
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
* @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 reactions = signal.reactions;
@ -829,7 +829,7 @@ export function mark_signal_consumers(signal, to_status, force_schedule) {
if ((flags & IS_EFFECT) !== 0) {
schedule_effect(/** @type {import('#client').Effect} */ (reaction), false);
} else {
mark_signal_consumers(
mark_signal_reactions(
/** @type {import('#client').Value} */ (reaction),
MAYBE_DIRTY,
force_schedule

Loading…
Cancel
Save