@snugug @astro @sveltejs can you clarify what you mean by „in my script tag“?
async Svelte in Astro works pretty well so far. I’ve tested these constellations and for islands I wrote some lines here: https://fubits.dev/notes/svelte-5-patterns-async-remote/#updates
@snugug @astro @sveltejs that’s a conceptual problem, not an async Svelte one.
Svelte is a frontend framework. Astro is a meta-framework like SvelteKit / Next / Nuxt.
Astro‘s content API belongs in Astro-land.
Frontend in Astro lives in client islands (unless wrapped in Server Islands).
You can only pass entries to Svelte (maybe even as a Promise) as props/children.
And pre-rendering would be tricky.
There’s an experimental API tho https://docs.astro.build/en/reference/container-reference/
@snugug @astro @sveltejs hm, here’s a working example with async fetch and different client directives https://fubits.dev/svelte-async-server-island/
What helped me grok the relationship between Astro and async Svelte was starting with a very minimal example in StackBlitz. Maybe you could create a reproducible example of your bug.
@snugug @astro @sveltejs I’m not sure if I understand by „server-only component“ but if you omit the boundary in Svelte and omit the client directive in Astro, the Svelte component will run at build time, pre-render and not hydrate on the client.
As in - the async-fetched joke example „without `svelte:boundary` + no client directive?“ further down here is static: https://fubits.dev/svelte-async-ssr/
@fubits @astro @sveltejs Ok, great, this is what I'm looking for and can't replicate (getting a svelte boundary error). I'll look at this example and see what the difference is.
And yes, I understand it won't hydrate on the client side. I personally prefer Svelte's DSL for templating to JSX that Astro uses, so I write most of my non-hydrated components with Svelte.
@fubits @astro @sveltejs Ok, I think there must have been something wrong with the codebase I was testing in, this works as expected (even using getEntry from a Svelte component) in a clean repo. I'm curious as to how your sample app is working through; the async rendering for Astro should only be 5.14+ and yours is 5.13.10.
Either way, I've got it working now. Thanks for chatting!