move code where it belongs

pull/15844/head
Rich Harris 3 months ago
parent fa1deacd0e
commit 6f12c0901e

@ -17,7 +17,6 @@ import { get_pending_boundary } from '../dom/blocks/boundary.js';
import { import {
active_effect, active_effect,
check_dirtiness, check_dirtiness,
dev_effect_stack,
is_updating_effect, is_updating_effect,
set_is_updating_effect, set_is_updating_effect,
set_signal_status, set_signal_status,
@ -45,6 +44,9 @@ export let current_batch = null;
*/ */
export let batch_deriveds = null; export let batch_deriveds = null;
/** @type {Effect[]} Stack of effects, dev only */
export let dev_effect_stack = [];
/** @type {Effect[]} */ /** @type {Effect[]} */
let queued_root_effects = []; let queued_root_effects = [];
@ -365,7 +367,7 @@ export class Batch {
last_scheduled_effect = null; last_scheduled_effect = null;
if (DEV) { if (DEV) {
dev_effect_stack.length = 0; dev_effect_stack = [];
} }
} }
} }
@ -469,7 +471,7 @@ export function flushSync(fn) {
last_scheduled_effect = null; last_scheduled_effect = null;
if (DEV) { if (DEV) {
dev_effect_stack.length = 0; dev_effect_stack = [];
} }
return /** @type {T} */ (result); return /** @type {T} */ (result);
@ -485,7 +487,7 @@ function log_effect_stack() {
'Last ten effects were: ', 'Last ten effects were: ',
dev_effect_stack.slice(-10).map((d) => d.fn) dev_effect_stack.slice(-10).map((d) => d.fn)
); );
dev_effect_stack.length = 0; dev_effect_stack = [];
} }
function infinite_loop_guard() { function infinite_loop_guard() {

@ -43,7 +43,13 @@ import {
set_dev_stack set_dev_stack
} from './context.js'; } from './context.js';
import * as w from './warnings.js'; import * as w from './warnings.js';
import { Batch, batch_deriveds, flushSync, schedule_effect } from './reactivity/batch.js'; import {
Batch,
batch_deriveds,
dev_effect_stack,
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';
@ -61,9 +67,6 @@ export function set_is_destroying_effect(value) {
is_destroying_effect = value; is_destroying_effect = value;
} }
/** @type {Effect[]} Stack of effects, dev only */
export let dev_effect_stack = [];
/** @type {null | Reaction} */ /** @type {null | Reaction} */
export let active_reaction = null; export let active_reaction = null;

Loading…
Cancel
Save