Skip to content

Conversation

@hmnd
Copy link
Contributor

@hmnd hmnd commented Dec 15, 2025

fixes sveltejs/kit#15059, fixes #17342, fixes #17111, fixes #17323, fixes #17352

#17105 resulted in a few regressions to how deriveds with no dependencies are treated. At worst, it broke reactivity for deriveds in branch effects, but I realized it also casued perf regressions like #17342. Both are now addressed, with tests to match.

To summarize, the issues I've fixed are:

  • deriveds with no deps were always getting set as MAYBE_DIRTY when they should have been CLEAN, resulting in excessive re-evaluation
  • deriveds couldn't reconnect when read in a branch effect (because effect_tracking() is false there)
  • child deriveds weren't being reconnected when read by a connected parent derived (5.43.4+ $derived doesn't update #17352)

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 Dec 15, 2025

🦋 Changeset detected

Latest commit: f00cdee

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

@svelte-docs-bot
Copy link

@github-actions
Copy link
Contributor

Playground

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

@hmnd hmnd force-pushed the push-spyzomlslloo branch from 2e7ecea to 8ff5006 Compare December 15, 2025 07:06
@hmnd hmnd force-pushed the push-spyzomlslloo branch from 8ff5006 to 3268f7d Compare December 15, 2025 21:57
@hmnd hmnd changed the title fix: reconnect deriveds inside branch effects fix: derived reactivity regressions from #17342 Dec 15, 2025
@hmnd hmnd changed the title fix: derived reactivity regressions from #17342 fix: derived reactivity regressions from #17105 Dec 15, 2025
@hmnd hmnd changed the title fix: derived reactivity regressions from #17105 fix: derived reactivity and perf regressions Dec 15, 2025
@hmnd hmnd force-pushed the push-spyzomlslloo branch from 6250ba5 to 3b7d3c7 Compare December 16, 2025 18:38
@hmnd hmnd force-pushed the push-spyzomlslloo branch from 3b7d3c7 to f00cdee Compare December 16, 2025 18:50
@hmnd
Copy link
Contributor Author

hmnd commented Dec 17, 2025

@paoloricciuti would love if you could review/merge this one too :)

As you can see, this regression is the source of many head aches!

@paoloricciuti
Copy link
Member

@hmnd yeah I already took a look...I think the fix makes sense but I'm not super familiar with the logic of the connected deriveds as I would like so I would not feel confident to review and merge this on my own. I've already shared it in the maintainers chat yesterday tho so hopefully we can get this merged soon.

Thanks for your effort 🧡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment