diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index 4c50781817..5a041f9703 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -27,8 +27,6 @@ import { get, increment_write_version, is_dirty, - is_updating_effect, - set_is_updating_effect, update_effect } from '../runtime.js'; import * as e from '../errors.js'; @@ -561,14 +559,12 @@ export function flushSync(fn) { } function flush_effects() { - var was_updating_effect = is_updating_effect; is_flushing = true; var source_stacks = DEV ? new Set() : null; try { var flush_count = 0; - set_is_updating_effect(true); while (queued_root_effects.length > 0) { var batch = Batch.ensure(); @@ -612,7 +608,6 @@ function flush_effects() { } } finally { is_flushing = false; - set_is_updating_effect(was_updating_effect); last_scheduled_effect = null; diff --git a/packages/svelte/src/internal/client/reactivity/sources.js b/packages/svelte/src/internal/client/reactivity/sources.js index 6333962f41..7604c9e90b 100644 --- a/packages/svelte/src/internal/client/reactivity/sources.js +++ b/packages/svelte/src/internal/client/reactivity/sources.js @@ -13,9 +13,7 @@ import { is_dirty, untracking, is_destroying_effect, - push_reaction_value, - set_is_updating_effect, - is_updating_effect + push_reaction_value } from '../runtime.js'; import { equals, safe_equals } from './equality.js'; import { @@ -261,25 +259,17 @@ export function internal_set(source, value) { export function flush_eager_effects() { eager_effects_deferred = false; - var prev_is_updating_effect = is_updating_effect; - set_is_updating_effect(true); - const inspects = Array.from(eager_effects); - - try { - for (const effect of inspects) { - // Mark clean inspect-effects as maybe dirty and then check their dirtiness - // instead of just updating the effects - this way we avoid overfiring. - if ((effect.f & CLEAN) !== 0) { - set_signal_status(effect, MAYBE_DIRTY); - } + for (const effect of eager_effects) { + // Mark clean inspect-effects as maybe dirty and then check their dirtiness + // 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)) { - update_effect(effect); - } + if (is_dirty(effect)) { + update_effect(effect); } - } finally { - set_is_updating_effect(prev_is_updating_effect); } eager_effects.clear(); diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 6988c6247a..19b98d0c0f 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -43,25 +43,14 @@ import { set_dev_current_component_function, set_dev_stack } from './context.js'; -import { - Batch, - batch_values, - current_batch, - flushSync, - schedule_effect -} from './reactivity/batch.js'; +import { Batch, batch_values, flushSync, schedule_effect } from './reactivity/batch.js'; import { handle_error } from './error-handling.js'; import { UNINITIALIZED } from '../../constants.js'; import { captured_signals } from './legacy.js'; import { without_reactive_context } from './dom/elements/bindings/shared.js'; import { set_signal_status, update_derived_status } from './reactivity/status.js'; -export let is_updating_effect = false; - -/** @param {boolean} value */ -export function set_is_updating_effect(value) { - is_updating_effect = value; -} +let is_updating_effect = false; export let is_destroying_effect = false;