Skip to content

Commit 350a32a

Browse files
docs: mention {#await} on non-Promise values short-circuiting to the fullfilled branch
Fixes sveltejs/kit#10882
1 parent 6f508a0 commit 350a32a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

documentation/docs/02-template-syntax/03-logic-blocks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ Since Svelte 4 it is possible to iterate over iterables like `Map` or `Set`. Ite
152152
{#await expression catch name}...{/await}
153153
```
154154

155-
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.
155+
Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected.
156+
In SSR mode, only the pending branch will be rendered on the server.
157+
If the provided expression is not a Promise only the fulfilled branch will be rendered, including in SSR mode.
156158

157159
```svelte
158160
{#await promise}
159161
<!-- promise is pending -->
160162
<p>waiting for the promise to resolve...</p>
161163
{:then value}
162-
<!-- promise was fulfilled -->
164+
<!-- promise was fulfilled or not a Promise -->
163165
<p>The value is {value}</p>
164166
{:catch error}
165167
<!-- promise was rejected -->

0 commit comments

Comments
 (0)