Skip to content

Conversation

Ocean-OS
Copy link
Member

Currently, await expressions not inside an async derived are wrapped in track_reactivity_loss in dev to warn of a reactivity loss.
However, for await loops are not. This PR fixes that.

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

Copy link

changeset-bot bot commented Jul 29, 2025

🦋 Changeset detected

Latest commit: 88ba8e4

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

Copy link
Contributor

Playground

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

@svelte-docs-bot
Copy link

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever solution, I like this much more than convoluted code transformations. I guess we need to decide whether we separately want to handle for await at the top level of components. Seems like a footgun but maybe there's a case where it would be useful? At the moment it won't compile (which is better than compiling but with broken reactivity)

@Rich-Harris Rich-Harris merged commit b181c45 into main Aug 6, 2025
15 checks passed
@Rich-Harris Rich-Harris deleted the track-reactivity-loss-for-await branch August 6, 2025 01:44
@github-actions github-actions bot mentioned this pull request Aug 6, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants