Skip to content

Svelte boundaries fail with remote function and being called in script #16978

@Hysterelius

Description

@Hysterelius

Describe the bug

When a remote function is called and the result is awaited in <svelte:boundary> while there is also a remote function which is called without a boundary.

i.e., like so

<script lang="ts">
	import { getDelayedData } from './data.remote';

	const moreData = await getDelayedData();
</script>

<h1>Dashboard</h1>

<svelte:boundary>
	<span>Protected Data</span>
	<p>Secret: {await getDelayedData()}</p>
	{#snippet pending()}
		<p>loading...</p>
	{/snippet}
</svelte:boundary>

<pre>
    {moreData}
</pre>

The page will forever show the loading state.

However, if you call the function inline like so, it works correctly,

<script lang="ts">
	import { getDelayedData } from './data.remote';
</script>

<h1>Dashboard</h1>

<svelte:boundary>
	<span>Protected Data</span>
	<p>Secret: {await getDelayedData()}</p>
	{#snippet pending()}
		<p>loading...</p>
	{/snippet}
</svelte:boundary>

<pre>
    {await getDelayedData()}
</pre>

Reproduction

Full repo is here, https://github.com/Hysterelius/better-auth-sveltekit-demo

Logs

System Info

Binaries:
    Node: 24.3.0 - /home/hys/.local/share/pnpm/node
    npm: 11.4.2 - /home/hys/.local/share/pnpm/npm
    pnpm: 10.18.3 - /home/hys/.local/share/pnpm/pnpm
    Deno: 2.3.6 - /home/hys/.deno/bin/deno
  Browsers:
    Chrome: 141.0.7390.107
    Firefox: 144.0
    Firefox Developer Edition: 144.0
  npmPackages:
    svelte: ^5.41.0 => 5.41.0

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions