Skip to content

Conversation

@half2me
Copy link
Contributor

@half2me half2me commented Jan 24, 2026

PR #17461 added the wait function to reactivity/async.js and modified the compiler to generate $.wait() calls, but forgot to export it from index.js.

This causes a runtime error when using multiple await expressions inside $derived() with experimental.async: true:

TypeError: $.wait is not a function. (In '$.wait([$$promises[20], $$promises[20]])', '$.wait' is undefined)

The $.wait function is called by the compiler when there are multiple async blockers that need to be waited on together.

Fixes #17529

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Added test async-derived-multiple-blockers which uses multiple async deriveds together, triggering the $.wait call that was previously missing.

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2026

🦋 Changeset detected

Latest commit: e15548d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@half2me half2me force-pushed the fix-wait-export branch 2 times, most recently from 219a8a0 to 684120c Compare January 24, 2026 14:16
PR sveltejs#17461 added the `wait` function to `reactivity/async.js` and modified the compiler to generate `$.wait()` calls, but forgot to export it from `index.js`.

This causes a runtime error when using `await` inside `$derived()` with `experimental.async: true`:

```
TypeError: $.wait is not a function
```

Fixes sveltejs#17529
@paoloricciuti
Copy link
Member

Thanks! 🧡

@github-actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@17530

@paoloricciuti paoloricciuti merged commit 6046bbb into sveltejs:main Jan 24, 2026
14 checks passed
@github-actions github-actions bot mentioned this pull request Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: wait function not exported from internal client index causing runtime error in 5.48.1

2 participants