fix: generate correct SSR code for the case where `pending` is an attribute

pull/16919/head
paoloricciuti 15 hours ago
parent 9c350cfdab
commit 6651f5e236

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: generate correct SSR code for the case where `pending` is an attribute

@ -43,11 +43,14 @@ export function SvelteBoundary(node, context) {
);
const pending = b.call(callee, b.id('$$renderer'));
const block = /** @type {BlockStatement} */ (context.visit(node.fragment));
const statement = node.fragment.metadata.has_await
? create_async_block(b.block([block]))
: block;
context.state.template.push(
b.if(
callee,
b.block(build_template([block_open_else, pending, block_close])),
b.block(build_template([block_open, block, block_close]))
b.block([b.stmt(pending)]),
b.block(build_template([block_open, statement, block_close]))
)
);
} else {

@ -0,0 +1,3 @@
import { test } from '../../test';
export default test({});

@ -0,0 +1,8 @@
{#snippet pending()}
Loading...
{/snippet}
<svelte:boundary pending={pending}>
{@const data = await Promise.resolve('hello')}
<p>{data}</p>
</svelte:boundary>
Loading…
Cancel
Save