remove deadcode

async-fork
Dominic Gannaway 7 months ago
parent b6be14a00a
commit 60f3ded1ff

@ -6,8 +6,7 @@ import {
DIRTY,
EFFECT_PRESERVED,
EFFECT_RAN,
EFFECT_TRANSPARENT,
RENDER_EFFECT
EFFECT_TRANSPARENT
} from '../../constants.js';
import { component_context, set_component_context } from '../../context.js';
import { block, branch, destroy_effect, pause_effect } from '../../reactivity/effects.js';
@ -18,9 +17,7 @@ import {
set_active_effect,
set_active_reaction,
reset_is_throwing_error,
schedule_effect,
check_dirtiness,
update_effect
schedule_effect
} from '../../runtime.js';
import {
hydrate_next,
@ -42,9 +39,6 @@ import { mark_reactions } from '../../reactivity/sources.js';
const ASYNC_INCREMENT = Symbol();
const ASYNC_DECREMENT = Symbol();
const ADD_CALLBACK = Symbol();
const ADD_RENDER_EFFECT = Symbol();
const ADD_EFFECT = Symbol();
const COMMIT = Symbol();
/**
* @param {Effect} boundary
@ -109,12 +103,6 @@ export function boundary(node, props, children) {
/** @type {Set<() => void>} */
var callbacks = new Set();
/** @type {Effect[]} */
var render_effects = [];
/** @type {Effect[]} */
var effects = [];
var keep_pending_snippet = false;
/**
@ -184,16 +172,6 @@ export function boundary(node, props, children) {
}
sources.clear();
for (const e of render_effects) {
try {
if (check_dirtiness(e)) {
update_effect(e);
}
} catch (error) {
handle_error(error, e, null, e.ctx);
}
}
for (const fn of callbacks) fn();
callbacks.clear();
@ -207,16 +185,6 @@ export function boundary(node, props, children) {
anchor.before(offscreen_fragment);
offscreen_fragment = null;
}
for (const e of effects) {
try {
if (check_dirtiness(e)) {
update_effect(e);
}
} catch (error) {
handle_error(error, e, null, e.ctx);
}
}
}
/**
@ -299,21 +267,6 @@ export function boundary(node, props, children) {
return;
}
if (input === ADD_RENDER_EFFECT) {
render_effects.push(payload);
return;
}
if (input === ADD_EFFECT) {
effects.push(payload);
return;
}
if (input === COMMIT) {
unsuspend();
return;
}
var error = input;
var onerror = props.onerror;
let failed = props.failed;
@ -452,6 +405,9 @@ export function is_pending_boundary(boundary) {
return boundary.fn.is_pending();
}
/**
* @param {Effect | null} effect
*/
export function get_boundary(effect) {
var boundary = effect;
@ -526,20 +482,3 @@ export function add_boundary_callback(boundary, fn) {
// @ts-ignore
boundary.fn(ADD_CALLBACK, fn);
}
/**
* @param {Effect} boundary
* @param {Effect} effect
*/
export function add_boundary_effect(boundary, effect) {
// @ts-ignore
boundary.fn((effect.f & RENDER_EFFECT) !== 0 ? ADD_RENDER_EFFECT : ADD_EFFECT, effect);
}
/**
* @param {Effect} boundary
*/
export function commit_boundary(boundary) {
// @ts-ignore
boundary.fn?.(COMMIT);
}

@ -25,7 +25,6 @@ import {
DISCONNECTED,
BOUNDARY_EFFECT,
REACTION_IS_UPDATING,
BOUNDARY_SUSPENDED,
ASYNC_DERIVED
} from './constants.js';
import {
@ -51,7 +50,7 @@ import {
set_component_context,
set_dev_current_component_function
} from './context.js';
import { add_boundary_effect, commit_boundary, get_boundary } from './dom/blocks/boundary.js';
import { get_boundary } from './dom/blocks/boundary.js';
import * as w from './warnings.js';
const FLUSH_MICROTASK = 0;
@ -70,6 +69,7 @@ let is_micro_task_queued = false;
let last_scheduled_effect = null;
export let is_flushing_effect = false;
export let is_flushing_async_derived = false;
export let is_destroying_effect = false;
/** @param {boolean} value */
@ -858,8 +858,12 @@ function process_effects(effect, collected_effects) {
// to ensure that unowned deriveds are correctly tracked
// because we're flushing the current effect
var previous_active_reaction = active_reaction;
var previous_is_flushing_async_derived = is_flushing_async_derived;
try {
active_reaction = current_effect;
if ((current_effect.f & ASYNC_DERIVED) !== 0) {
is_flushing_async_derived = true;
}
if (check_dirtiness(current_effect)) {
update_effect(current_effect);
}
@ -867,6 +871,7 @@ function process_effects(effect, collected_effects) {
handle_error(error, current_effect, null, current_effect.ctx);
} finally {
active_reaction = previous_active_reaction;
is_flushing_async_derived = previous_is_flushing_async_derived;
}
}
@ -1050,7 +1055,7 @@ export function get(signal) {
} else {
var target_effect = event_boundary_effect ?? active_effect;
if (target_effect !== null && (target_effect.f & ASYNC_DERIVED) === 0) {
if (target_effect !== null && !is_flushing_async_derived) {
var boundary = get_boundary(target_effect);
if (boundary !== null) {
var sources = boundary.fn.sources;

Loading…
Cancel
Save