|
|
@ -46,9 +46,6 @@ 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 {Set<() => void>} */
|
|
|
|
/** @type {Set<() => void>} */
|
|
|
|
export let effect_pending_updates = new Set();
|
|
|
|
export let effect_pending_updates = new Set();
|
|
|
|
|
|
|
|
|
|
|
@ -378,9 +375,6 @@ export class Batch {
|
|
|
|
set_is_updating_effect(was_updating_effect);
|
|
|
|
set_is_updating_effect(was_updating_effect);
|
|
|
|
|
|
|
|
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
if (DEV) {
|
|
|
|
|
|
|
|
dev_effect_stack = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -493,10 +487,6 @@ export function flushSync(fn) {
|
|
|
|
// we need to reset it here as well in case the first time there's 0 queued root effects
|
|
|
|
// we need to reset it here as well in case the first time there's 0 queued root effects
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (DEV) {
|
|
|
|
|
|
|
|
dev_effect_stack = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return /** @type {T} */ (result);
|
|
|
|
return /** @type {T} */ (result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -504,15 +494,6 @@ export function flushSync(fn) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function log_effect_stack() {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
|
|
|
|
console.error(
|
|
|
|
|
|
|
|
'Last ten effects were: ',
|
|
|
|
|
|
|
|
dev_effect_stack.slice(-10).map((d) => d.fn)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
dev_effect_stack = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function infinite_loop_guard() {
|
|
|
|
function infinite_loop_guard() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
e.effect_update_depth_exceeded();
|
|
|
|
e.effect_update_depth_exceeded();
|
|
|
@ -526,21 +507,8 @@ function infinite_loop_guard() {
|
|
|
|
// Try and handle the error so it can be caught at a boundary, that's
|
|
|
|
// Try and handle the error so it can be caught at a boundary, that's
|
|
|
|
// if there's an effect available from when it was last scheduled
|
|
|
|
// if there's an effect available from when it was last scheduled
|
|
|
|
if (last_scheduled_effect !== null) {
|
|
|
|
if (last_scheduled_effect !== null) {
|
|
|
|
if (DEV) {
|
|
|
|
invoke_error_boundary(error, last_scheduled_effect);
|
|
|
|
try {
|
|
|
|
|
|
|
|
invoke_error_boundary(error, last_scheduled_effect);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
// Only log the effect stack if the error is re-thrown
|
|
|
|
|
|
|
|
log_effect_stack();
|
|
|
|
|
|
|
|
throw e;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
invoke_error_boundary(error, last_scheduled_effect);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (DEV) {
|
|
|
|
|
|
|
|
log_effect_stack();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw error;
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|