docs: mention `{#await}` on non-Promise values short-circuiting to the fullfilled branch (#9324)

Fixes #9323
pull/9333/head
Ravi van Rooijen 1 year ago committed by GitHub
parent 9900c85acf
commit 1ed9182025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -152,14 +152,16 @@ Since Svelte 4 it is possible to iterate over iterables like `Map` or `Set`. Ite
{#await expression catch name}...{/await} {#await expression catch name}...{/await}
``` ```
Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected. In SSR mode, only the pending state will be rendered on the server. Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected.
In SSR mode, only the pending branch will be rendered on the server.
If the provided expression is not a Promise only the fulfilled branch will be rendered, including in SSR mode.
```svelte ```svelte
{#await promise} {#await promise}
<!-- promise is pending --> <!-- promise is pending -->
<p>waiting for the promise to resolve...</p> <p>waiting for the promise to resolve...</p>
{:then value} {:then value}
<!-- promise was fulfilled --> <!-- promise was fulfilled or not a Promise -->
<p>The value is {value}</p> <p>The value is {value}</p>
{:catch error} {:catch error}
<!-- promise was rejected --> <!-- promise was rejected -->

Loading…
Cancel
Save