-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: reconnected deep derived signals to graph #12350
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
Conversation
🦋 Changeset detectedLatest commit: c665ddf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Huh — should be happening here. It definitely doesn't need to happen in both places svelte/packages/svelte/src/internal/client/runtime.js Lines 775 to 792 in e8c3729
|
@Rich-Harris I know it's done there, but that logic never gets applied to this signal because if there are multiple disconnected signals, then only the outer signal gets called via |
Why isn't the outer derived |
@Rich-Harris I added a test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weirds me out a bit that we need to call this in two places — it feels like there should be a single choke point where this work can happen, and it feels weird to have this sort of side-effect in check_dirtiness
— but I haven't wrapped my head around what that would look like. made a few suggestions
Co-authored-by: Rich Harris <[email protected]>
Co-authored-by: Rich Harris <[email protected]>
I haven't benchmarked this, but it kind of feels wasteful to do another O(n() lookup in each case of |
It's not — we early-return as soon as we find a dirty dependency, so we have a choice:
Since reconnecting a disconnected derived is a fairly unusual case, number 2 turns out to be much slower — I validated this via the benchmarks in #12272. Anyway, I figured out how to make it unnecessary to call |
Fixes #12330.