Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 15, 2025
1 parent 4ef2be3 commit 278c490
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/svelte/src/internal/client/dom/blocks/boundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ export function boundary(node, props, boundary_fn) {

if (suspend_count++ === 0) {
queue_micro_task(() => {
if (suspended_effect) {
return;
}

var effect = boundary_effect;
suspended_effect = boundary_effect;

Expand Down Expand Up @@ -149,14 +153,20 @@ export function boundary(node, props, boundary_fn) {
return false;
}

if (--suspend_count === 0 && suspended_effect !== null) {
if (boundary_effect) {
destroy_effect(boundary_effect);
}
boundary_effect = suspended_effect;
suspended_effect = null;
anchor.before(/** @type {DocumentFragment} */ (suspended_fragment));
resume_effect(boundary_effect);
if (--suspend_count === 0) {
queue_micro_task(() => {
if (!suspended_effect) {
return;
}

if (boundary_effect) {
destroy_effect(boundary_effect);
}
boundary_effect = suspended_effect;
suspended_effect = null;
anchor.before(/** @type {DocumentFragment} */ (suspended_fragment));
resume_effect(boundary_effect);
});
}

return true;
Expand Down

0 comments on commit 278c490

Please sign in to comment.