chore: remove `set_is_updating_effect` (#17459)

pull/17521/head
Rich Harris 7 months ago committed by GitHub
parent 7719d0312c
commit 1ed458edc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,8 +27,6 @@ import {
get, get,
increment_write_version, increment_write_version,
is_dirty, is_dirty,
is_updating_effect,
set_is_updating_effect,
update_effect update_effect
} from '../runtime.js'; } from '../runtime.js';
import * as e from '../errors.js'; import * as e from '../errors.js';
@ -561,14 +559,12 @@ export function flushSync(fn) {
} }
function flush_effects() { function flush_effects() {
var was_updating_effect = is_updating_effect;
is_flushing = true; is_flushing = true;
var source_stacks = DEV ? new Set() : null; var source_stacks = DEV ? new Set() : null;
try { try {
var flush_count = 0; var flush_count = 0;
set_is_updating_effect(true);
while (queued_root_effects.length > 0) { while (queued_root_effects.length > 0) {
var batch = Batch.ensure(); var batch = Batch.ensure();
@ -612,7 +608,6 @@ function flush_effects() {
} }
} finally { } finally {
is_flushing = false; is_flushing = false;
set_is_updating_effect(was_updating_effect);
last_scheduled_effect = null; last_scheduled_effect = null;

@ -13,9 +13,7 @@ import {
is_dirty, is_dirty,
untracking, untracking,
is_destroying_effect, is_destroying_effect,
push_reaction_value, push_reaction_value
set_is_updating_effect,
is_updating_effect
} from '../runtime.js'; } from '../runtime.js';
import { equals, safe_equals } from './equality.js'; import { equals, safe_equals } from './equality.js';
import { import {
@ -261,25 +259,17 @@ export function internal_set(source, value) {
export function flush_eager_effects() { export function flush_eager_effects() {
eager_effects_deferred = false; eager_effects_deferred = false;
var prev_is_updating_effect = is_updating_effect;
set_is_updating_effect(true);
const inspects = Array.from(eager_effects); for (const effect of eager_effects) {
// Mark clean inspect-effects as maybe dirty and then check their dirtiness
try { // instead of just updating the effects - this way we avoid overfiring.
for (const effect of inspects) { if ((effect.f & CLEAN) !== 0) {
// Mark clean inspect-effects as maybe dirty and then check their dirtiness set_signal_status(effect, MAYBE_DIRTY);
// instead of just updating the effects - this way we avoid overfiring. }
if ((effect.f & CLEAN) !== 0) {
set_signal_status(effect, MAYBE_DIRTY);
}
if (is_dirty(effect)) { if (is_dirty(effect)) {
update_effect(effect); update_effect(effect);
}
} }
} finally {
set_is_updating_effect(prev_is_updating_effect);
} }
eager_effects.clear(); eager_effects.clear();

@ -43,25 +43,14 @@ import {
set_dev_current_component_function, set_dev_current_component_function,
set_dev_stack set_dev_stack
} from './context.js'; } from './context.js';
import { import { Batch, batch_values, flushSync, schedule_effect } from './reactivity/batch.js';
Batch,
batch_values,
current_batch,
flushSync,
schedule_effect
} from './reactivity/batch.js';
import { handle_error } from './error-handling.js'; import { handle_error } from './error-handling.js';
import { UNINITIALIZED } from '../../constants.js'; import { UNINITIALIZED } from '../../constants.js';
import { captured_signals } from './legacy.js'; import { captured_signals } from './legacy.js';
import { without_reactive_context } from './dom/elements/bindings/shared.js'; import { without_reactive_context } from './dom/elements/bindings/shared.js';
import { set_signal_status, update_derived_status } from './reactivity/status.js'; import { set_signal_status, update_derived_status } from './reactivity/status.js';
export let is_updating_effect = false; let is_updating_effect = false;
/** @param {boolean} value */
export function set_is_updating_effect(value) {
is_updating_effect = value;
}
export let is_destroying_effect = false; export let is_destroying_effect = false;

Loading…
Cancel
Save