From f90132c9164c589bbe74b7c317e57ebb092a1924 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 26 Feb 2025 16:45:32 -0500 Subject: [PATCH] fix --- .../svelte/src/internal/client/dom/blocks/boundary.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/blocks/boundary.js b/packages/svelte/src/internal/client/dom/blocks/boundary.js index 87e0d388dd..28a123b40c 100644 --- a/packages/svelte/src/internal/client/dom/blocks/boundary.js +++ b/packages/svelte/src/internal/client/dom/blocks/boundary.js @@ -107,17 +107,16 @@ export class Boundary { if (hydrating && pending) { this.#pending_effect = branch(() => pending(this.#anchor)); - // ...now what? we need to start rendering `boundary_fn` offscreen, - // and either insert the resulting fragment (if nothing suspends) - // or keep the pending effect alive until it unsuspends. - // not exactly sure how to do that. - // future work: when we have some form of async SSR, we will // need to use hydration boundary comments to report whether // the pending or main block was rendered for a given // boundary, and hydrate accordingly queueMicrotask(() => { - // destroy_effect(/** @type {Effect} */ (this.#pending_effect)); + if (this.#pending_count === 0) { + pause_effect(/** @type {Effect} */ (this.#pending_effect), () => { + this.#pending_effect = null; + }); + } this.#main_effect = this.#run(() => { return branch(() => this.#children(this.#anchor));