Skip to content

Conversation

@trueadm
Copy link
Contributor

@trueadm trueadm commented Jan 28, 2025

Fixes #15111.

We don't need to eagerly connect deriveds to their parents – we don't do this in effects, so we can apply the same heuristic here too. If we lazily do it upon read of the derived from within a parent derived. If no read is done, we skip pushing it into the children. This will avoid the buggy case linked, and also provide a nice performance uplift by avoiding array allocations for cases where don't need to do them.

@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2025

🦋 Changeset detected

Latest commit: 1867f40

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@15129

@gyzerok
Copy link
Contributor

gyzerok commented Jan 28, 2025

Tried version from this PR on our codebase. The issue is fixed. Also I clicked through the app and there are no observable regressions otherwise from the first glance.

Thank you for digging into it and your swift fix!

@trueadm trueadm merged commit fc4dd2d into main Jan 28, 2025
10 checks passed
@trueadm trueadm deleted the derived-children-lazy branch January 28, 2025 13:15
@github-actions github-actions bot mentioned this pull request Jan 27, 2025
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.

5.19.2 (and 5.19.3) fixed untrack error, but reactivity graph is broken somewhere

4 participants