async-changeset
Rich Harris 7 months ago
parent 9cc52e27d2
commit 1f58d6b7e4

@ -36,14 +36,6 @@ import { from_async_derived, set_from_async_derived } from '../../reactivity/der
import { raf } from '../../timing.js';
import { loop } from '../../loop.js';
/** @type {Boundary | null} */
export let active_boundary = null;
/** @param {Boundary | null} boundary */
export function set_active_boundary(boundary) {
active_boundary = boundary;
}
/**
* @typedef {{
* onerror?: (error: unknown, reset: () => void) => void;
@ -107,9 +99,7 @@ export class Boundary {
this.#props = props;
this.#children = children;
this.parent = active_boundary;
active_boundary = this;
this.parent = /** @type {Effect} */ (active_effect).b;
this.#effect = block(() => {
var boundary_effect = /** @type {Effect} */ (active_effect);
@ -245,8 +235,6 @@ export class Boundary {
if (hydrating) {
this.#anchor = hydrate_node;
}
active_boundary = this.parent;
}
has_pending_snippet() {
@ -257,12 +245,10 @@ export class Boundary {
* @param {() => Effect | null} fn
*/
#run(fn) {
var previous_boundary = active_boundary;
var previous_effect = active_effect;
var previous_reaction = active_reaction;
var previous_ctx = component_context;
active_boundary = this;
set_active_effect(this.#effect);
set_active_reaction(this.#effect);
set_component_context(this.#effect.ctx);
@ -270,7 +256,6 @@ export class Boundary {
try {
return fn();
} finally {
active_boundary = previous_boundary;
set_active_effect(previous_effect);
set_active_reaction(previous_reaction);
set_component_context(previous_ctx);

@ -39,7 +39,6 @@ import { queue_micro_task } from '../task.js';
import { active_effect, get } from '../../runtime.js';
import { DEV } from 'esm-env';
import { derived_safe_equal } from '../../reactivity/deriveds.js';
import { active_boundary } from './boundary.js';
/**
* The row of a keyed each block that is currently updating. We track this
@ -139,7 +138,7 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
var was_empty = false;
var boundary = active_boundary;
var boundary = /** @type {Effect} */ (active_effect).b;
/** @type {Map<any, EachItem>} */
var offscreen_items = new Map();

@ -10,8 +10,8 @@ import {
} from '../hydration.js';
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
import { HYDRATION_START_ELSE, UNINITIALIZED } from '../../../../constants.js';
import { active_boundary } from './boundary.js';
import { create_text, should_defer_append } from '../operations.js';
import { active_effect } from '../../runtime.js';
/**
* @param {TemplateNode} node
@ -50,7 +50,7 @@ export function if_block(node, fn, elseif = false) {
/** @type {Effect | null} */
var pending_effect = null;
var boundary = active_boundary;
var boundary = /** @type {Effect} */ (active_effect).b;
function commit() {
if (offscreen_fragment !== null) {

@ -4,8 +4,8 @@ import { block, branch, pause_effect } from '../../reactivity/effects.js';
import { not_equal, safe_not_equal } from '../../reactivity/equality.js';
import { is_runes } from '../../context.js';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
import { active_boundary } from './boundary.js';
import { create_text, should_defer_append } from '../operations.js';
import { active_effect } from '../../runtime.js';
/**
* @template V
@ -33,7 +33,7 @@ export function key_block(node, get_key, render_fn) {
/** @type {DocumentFragment | null} */
var offscreen_fragment = null;
var boundary = active_boundary;
var boundary = /** @type {Effect} */ (active_effect).b;
var changed = is_runes() ? not_equal : safe_not_equal;

@ -1,9 +1,9 @@
/** @import { TemplateNode, Dom, Effect } from '#client' */
import { EFFECT_TRANSPARENT } from '../../constants.js';
import { block, branch, pause_effect } from '../../reactivity/effects.js';
import { active_effect } from '../../runtime.js';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
import { create_text, should_defer_append } from '../operations.js';
import { active_boundary } from './boundary.js';
/**
* @template P
@ -32,7 +32,7 @@ export function component(node, get_component, render_fn) {
/** @type {Effect | null} */
var pending_effect = null;
var boundary = active_boundary;
var boundary = /** @type {Effect} */ (active_effect).b;
function commit() {
if (effect) {

@ -14,7 +14,6 @@ import {
set_is_flushing_effect,
set_signal_status,
untrack,
skip_reaction,
untracking
} from '../runtime.js';
import {
@ -34,8 +33,7 @@ import {
INSPECT_EFFECT,
HEAD_EFFECT,
MAYBE_DIRTY,
EFFECT_PRESERVED,
BOUNDARY_EFFECT
EFFECT_PRESERVED
} from '../constants.js';
import { set } from './sources.js';
import * as e from '../errors.js';
@ -43,7 +41,7 @@ import { DEV } from 'esm-env';
import { define_property } from '../../shared/utils.js';
import { get_next_sibling } from '../dom/operations.js';
import { async_derived, derived } from './deriveds.js';
import { active_boundary, capture, suspend } from '../dom/blocks/boundary.js';
import { capture, suspend } from '../dom/blocks/boundary.js';
import { component_context, dev_current_component_function } from '../context.js';
/**

Loading…
Cancel
Save