Skip to content

Conversation

@hmnd
Copy link
Contributor

@hmnd hmnd commented Jan 21, 2026

fixes #17471, fixes #17394

This was happening because mutable_source uses safe_equals which always treats objects as different, so the async derived within would always be marked as dirty and re-run.

My fix tracks object refs between async derived runs, and skips re-running if they haven't changed. I've included two test samples, as my first pass at this didn't check if we were in the same batch, which broke updating a prop on an object with an unchanged ref. I haven't been able to get the first sample with each to fail because it freezes the test runner instead :) not sure how best to handle that without introducing a timeout feature to the runner.

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

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 6ed3a05

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

@github-actions
Copy link
Contributor

Playground

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

@hmnd hmnd force-pushed the push-tmutsvrmtqqk branch from e23f2d5 to 6ed3a05 Compare January 21, 2026 06:54
@hmnd hmnd changed the title fix: await in store's each block re-runs infinitely fix: await in each block over store re-runs infinitely Jan 21, 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.

"svelte/store" with Asynchronous Svelte freezes the browser Infinite loop caused by await in each

1 participant