Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lazily connect derievds (in deriveds) to their parent #15129

Merged
merged 1 commit into from
Jan 28, 2025

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.

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

Copy link
Contributor

Playground

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

@gyzerok
Copy link

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
3 participants