Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 30, 2025
1 parent 5b0b9eb commit 9d9198a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/svelte/src/internal/client/dom/blocks/boundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { get_next_sibling } from '../operations.js';
import { queue_boundary_micro_task } from '../task.js';
import * as e from '../../../shared/errors.js';
import { run_all } from '../../../shared/utils.js';

const ASYNC_INCREMENT = Symbol();
const ASYNC_DECREMENT = Symbol();
Expand Down Expand Up @@ -82,7 +83,7 @@ export function boundary(node, props, children) {
var hydrate_open = hydrate_node;
var is_creating_fallback = false;

/** @type {Function[]} */
/** @type {Array<() => void>} */
var callbacks = [];

/**
Expand Down Expand Up @@ -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
boundary.fn = (/** @type {unknown} */ input, /** @type {Function} */ payload) => {
boundary.fn = (/** @type {unknown} */ input, /** @type {() => void} */ payload) => {
if (input === ASYNC_INCREMENT) {
boundary.f |= BOUNDARY_SUSPENDED;
async_count++;
Expand All @@ -138,10 +139,7 @@ export function boundary(node, props, children) {
if (--async_count === 0) {
boundary.f ^= BOUNDARY_SUSPENDED;

for (const callback of callbacks) {
callback();
}

run_all(callbacks);
callbacks.length = 0;

if (pending_effect) {
Expand Down

0 comments on commit 9d9198a

Please sign in to comment.