aa-coordination
Rich Harris 8 months ago
parent 5b0b9eb261
commit 9d9198af9e

@ -23,6 +23,7 @@ import {
import { get_next_sibling } from '../operations.js'; import { get_next_sibling } from '../operations.js';
import { queue_boundary_micro_task } from '../task.js'; import { queue_boundary_micro_task } from '../task.js';
import * as e from '../../../shared/errors.js'; import * as e from '../../../shared/errors.js';
import { run_all } from '../../../shared/utils.js';
const ASYNC_INCREMENT = Symbol(); const ASYNC_INCREMENT = Symbol();
const ASYNC_DECREMENT = Symbol(); const ASYNC_DECREMENT = Symbol();
@ -82,7 +83,7 @@ export function boundary(node, props, children) {
var hydrate_open = hydrate_node; var hydrate_open = hydrate_node;
var is_creating_fallback = false; var is_creating_fallback = false;
/** @type {Function[]} */ /** @type {Array<() => void>} */
var callbacks = []; var callbacks = [];
/** /**
@ -124,7 +125,7 @@ export function boundary(node, props, children) {
} }
// @ts-ignore We re-use the effect's fn property to avoid allocation of an additional field // @ts-ignore We re-use the effect's fn property to avoid allocation of an additional field
boundary.fn = (/** @type {unknown} */ input, /** @type {Function} */ payload) => { boundary.fn = (/** @type {unknown} */ input, /** @type {() => void} */ payload) => {
if (input === ASYNC_INCREMENT) { if (input === ASYNC_INCREMENT) {
boundary.f |= BOUNDARY_SUSPENDED; boundary.f |= BOUNDARY_SUSPENDED;
async_count++; async_count++;
@ -138,10 +139,7 @@ export function boundary(node, props, children) {
if (--async_count === 0) { if (--async_count === 0) {
boundary.f ^= BOUNDARY_SUSPENDED; boundary.f ^= BOUNDARY_SUSPENDED;
for (const callback of callbacks) { run_all(callbacks);
callback();
}
callbacks.length = 0; callbacks.length = 0;
if (pending_effect) { if (pending_effect) {

Loading…
Cancel
Save