From 523c85bd3d592ab930e81fe29aef2805a41c7bf3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 23 Oct 2025 15:58:12 -0700 Subject: [PATCH] merge --- .changeset/huge-poets-tickle.md | 5 ---- .../internal/client/dom/blocks/boundary.js | 30 ++----------------- .../Child.svelte | 8 ----- .../_config.js | 25 ---------------- .../main.svelte | 23 -------------- 5 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 .changeset/huge-poets-tickle.md delete mode 100644 packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/Child.svelte delete mode 100644 packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/_config.js delete mode 100644 packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/main.svelte diff --git a/.changeset/huge-poets-tickle.md b/.changeset/huge-poets-tickle.md deleted file mode 100644 index f2b1ba6f25..0000000000 --- a/.changeset/huge-poets-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: coordinate mount of snippets with await expressions diff --git a/packages/svelte/src/internal/client/dom/blocks/boundary.js b/packages/svelte/src/internal/client/dom/blocks/boundary.js index 3c7e88b9ed..72e64b1a3a 100644 --- a/packages/svelte/src/internal/client/dom/blocks/boundary.js +++ b/packages/svelte/src/internal/client/dom/blocks/boundary.js @@ -30,7 +30,6 @@ import { skip_nodes, set_hydrate_node } from '../hydration.js'; -import { create_text } from '../operations.js'; import { queue_micro_task } from '../task.js'; import * as e from '../../errors.js'; import * as w from '../../warnings.js'; @@ -93,9 +92,6 @@ export class Boundary { /** @type {DocumentFragment | null} */ #offscreen_fragment = null; - /** @type {TemplateNode | null} */ - #pending_anchor = null; - #local_pending_count = 0; #pending_count = 0; @@ -159,17 +155,8 @@ export class Boundary { this.#hydrate_resolved_content(); } } else { - var anchor = this.#anchor; - - if (this.#pending) { - this.#pending_anchor = create_text(); - this.#anchor.before(this.#pending_anchor); - - anchor = this.#pending_anchor; - } - try { - this.#main_effect = branch(() => children(anchor)); + this.#main_effect = branch(() => children(this.#anchor)); } catch (error) { this.error(error); } @@ -178,7 +165,6 @@ export class Boundary { this.#show_pending_snippet(); } else { this.#pending = false; - this.#pending_anchor?.remove(); } } }, flags); @@ -208,18 +194,9 @@ export class Boundary { this.#pending_effect = branch(() => pending(this.#anchor)); Batch.enqueue(() => { - var anchor = this.#anchor; - - if (this.#pending) { - this.#pending_anchor = create_text(); - this.#anchor.before(this.#pending_anchor); - - anchor = this.#pending_anchor; - } - this.#main_effect = this.#run(() => { Batch.ensure(); - return branch(() => this.#children(anchor)); + return branch(() => this.#children(this.#anchor)); }); if (this.#pending_count > 0) { @@ -230,7 +207,6 @@ export class Boundary { }); this.#pending = false; - this.#pending_anchor?.remove(); } }); } @@ -276,7 +252,6 @@ export class Boundary { if (this.#main_effect !== null) { this.#offscreen_fragment = document.createDocumentFragment(); - this.#offscreen_fragment.append(/** @type {TemplateNode} */ (this.#pending_anchor)); move_effect(this.#main_effect, this.#offscreen_fragment); } @@ -312,7 +287,6 @@ export class Boundary { } if (this.#offscreen_fragment) { - this.#pending_anchor?.remove(); this.#anchor.before(this.#offscreen_fragment); this.#offscreen_fragment = null; } diff --git a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/Child.svelte b/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/Child.svelte deleted file mode 100644 index 9b708ddef4..0000000000 --- a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/Child.svelte +++ /dev/null @@ -1,8 +0,0 @@ - - -

message: {message}

-{@render children()} diff --git a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/_config.js b/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/_config.js deleted file mode 100644 index b6ca2ae3d2..0000000000 --- a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/_config.js +++ /dev/null @@ -1,25 +0,0 @@ -import { tick } from 'svelte'; -import { test } from '../../test'; - -export default test({ - async test({ assert, target }) { - const [shift] = target.querySelectorAll('button'); - - shift.click(); - await tick(); - - assert.htmlEqual(target.innerHTML, `

loading...

`); - - shift.click(); - await tick(); - - assert.htmlEqual( - target.innerHTML, - ` - -

message: hello from child

-

hello from parent

- ` - ); - } -}); diff --git a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/main.svelte b/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/main.svelte deleted file mode 100644 index 86768eb59d..0000000000 --- a/packages/svelte/tests/runtime-runes/samples/async-snippet-coordinated-mount/main.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - -

{await push('hello from parent')}

-
- - {#snippet pending()} -

loading...

- {/snippet} -