Skip to content

fix: avoid unnecessary block effect re-runs after async work completes#17535

Merged
Rich-Harris merged 4 commits intosveltejs:mainfrom
hmnd:push-kurwxsusnolq
Jan 25, 2026
Merged

fix: avoid unnecessary block effect re-runs after async work completes#17535
Rich-Harris merged 4 commits intosveltejs:mainfrom
hmnd:push-kurwxsusnolq

Conversation

@hmnd
Copy link
Copy Markdown
Contributor

@hmnd hmnd commented Jan 25, 2026

fixes #17471, fixes #17394

A much simpler alternative to #17500. This marks block effects as maybe dirty on Batch.revive(), forcing a dep check, and thus skipping re-runs of blocks that haven't changed (eg. each await nested inside an each over a store).

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
Copy Markdown

changeset-bot Bot commented Jan 25, 2026

🦋 Changeset detected

Latest commit: 42682fc

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
Copy Markdown
Contributor

Playground

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

Copy link
Copy Markdown
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.

that's a neat fix! would still love to avoid rescheduling in the first place, since they've already run, but we can leave figuring out how to make that work for another time

@Rich-Harris Rich-Harris merged commit fe12ffc into sveltejs:main Jan 25, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Jan 25, 2026
@hmnd hmnd deleted the push-kurwxsusnolq branch January 25, 2026 21:44
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

2 participants