Skip to content

Commit 8691391

Browse files
fix: add hydration markers in pending branch of SSR boundary (#16965)
1 parent 94fc836 commit 8691391

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

.changeset/happy-numbers-stick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: add hydration markers in `pending` branch of SSR boundary

packages/svelte/src/compiler/phases/3-transform/server/visitors/SvelteBoundary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function SvelteBoundary(node, context) {
4949
context.state.template.push(
5050
b.if(
5151
callee,
52-
b.block([b.stmt(pending)]),
52+
b.block(build_template([block_open_else, b.stmt(pending), block_close])),
5353
b.block(build_template([block_open, statement, block_close]))
5454
)
5555
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { flushSync } from 'svelte';
2+
import { assert_ok, test } from '../../test';
3+
4+
export default test({
5+
compileOptions: {
6+
experimental: {
7+
async: true
8+
}
9+
}
10+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!--[--><!--[!--><!---->loading...<!--]--><!--]-->
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{#snippet pending()}
2+
loading...
3+
{/snippet}
4+
5+
<svelte:boundary {pending}>
6+
{@const data = await Promise.resolve("data")}
7+
{data}
8+
</svelte:boundary>

0 commit comments

Comments
 (0)