Skip to content

Conversation

@dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Nov 1, 2025

Often deriveds are currently unowned but through graph traversal during is_dirty() might reconnect to the graph, therefore having dependent effects register themselves as reactions.

The problem prior to this fix was that the graph was not traversed to update the derived's dependencies and unowned status of deriveds when batch_values contained the derived - the batch value was just returned then -, which results in reactivity loss. #17024 (comment) contains a detailed rundown of such a case. The fix is to still traverse the graph, though not executing any deriveds in the process or resetting signals.

Fixes #17024
Fixes #17049 (comment) (and therefore everything that was still buggy in that issue I think)

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

Often deriveds are currently unowned but through graph traversal during `is_dirty()` might reconnect to the graph, therefore having dependent effects register themselves as reactions.

The problem prior to this fix was that the graph was not traversed to update the derived's dependencies and unowned status of deriveds in batch_values - the batch value was just returned -, which results in reactivity loss. #17024 (comment) contains a detailed rundown of such a case. The fix is to still traverse the graph, though not executing any deriveds in the process.

Fixes #17024
Fixes #17049 (comment) (and therefore everything that was still buggy in that issue I think)
@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

⚠️ No Changeset found

Latest commit: 2facb94

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Playground

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

@Rich-Harris
Copy link
Member

Started noodling on an alternative approach in #17102. Interestingly though: when I copied the test in this PR to the sandbox, it worked fine? It only fails when run as a test. Doesn't appear to be a dev/prod discrepancy, I haven't been able to figure out what's going on

@dummdidumm
Copy link
Member Author

dummdidumm commented Nov 3, 2025

Have you increased the timeout in the test file long enough for the playground so you have a chance to click on the button before the async work stops?

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.

Collection of bugs with async svelte & bits-ui & more (in a more "complex app") Rendering issues since 5.41.2

3 participants