Skip to content
Discussion options

You must be logged in to vote

Disgusting AI answers that provided little helpful insight aside, I figured I should follow up for anyone else that encounters this issue.

The solution that worked for me was to shift the await into the component body, wrapped around a <svelte:boundary>. This then allows me to conditionally pass a pending function on the boundary, depending on if the page should be preloaded or not:

<script>
import { browser } from "$app/env"
import { noJS } from "somePackage"

const { someProp, ...restProps } = $props()
const myData = $derived(myRemoteFunc(someProp))
</script>

{#snippet pending()}
  <span>loading...</span>
{/snippet}

<svelte:boundary pending={!browser && noJS ? undefined : pending}>
  …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sevmonster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants