await doesn't work with @const
#16462Closes #16462
feat:
, fix:
, chore:
, or docs:
.packages/svelte/src
, add a changeset (npx changeset
).pnpm test
and lint the project with pnpm lint
Currently, not every part of your component can be async— child fragments can't be. A fragment is the children inside of a block, such as an {#if }
block. Most fragments are compiled to synchronous functions. Since template expressions are individually compiled to functions that are either async or sync depending on their values, they can be async inside synchronous fragments. However, other things, such as {@const }
, can't be async, since you can't have await expressions inside synchronous functions.
This fixes that. Additionally, this makes certain features, such as variable declarations in markup, much easier to implement.
Closes #16462 Supersedes #16463
feat:
, fix:
, chore:
, or docs:
.packages/svelte/src
, add a changeset (npx changeset
).pnpm test
and lint the project with pnpm lint
Closes #16462
feat:
, fix:
, chore:
, or docs:
.packages/svelte/src
, add a changeset (npx changeset
).pnpm test
and lint the project with pnpm lint
Implemented by reusing the async_body
function inside Fragment.js
. Also removes the ability to reference a {@const ...}
of an implicit child inside a boundary pending/failed snippet:
Implemented via / only taking effect with the experimental flag so the behavior change only applies there as this is a breaking change strictly speaking. Also added a compiler error for this.
closes #16462
feat:
, fix:
, chore:
, or docs:
.packages/svelte/src
, add a changeset (npx changeset
).pnpm test
and lint the project with pnpm lint
await doesn't work when used in conjunction with @const
await isn't allowed in non-async function (Note that you need plugins to import files that are not JavaScript)
Using Svelte compiler version 5.36.12
running Svelte compiler version 5.36.12
blocking an upgrade
Still not working