Skip to content

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

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

Closed
gyzerok opened this issue Jan 25, 2025 · 2 comments · Fixed by #15129 or #15137
Closed

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

gyzerok opened this issue Jan 25, 2025 · 2 comments · Fixed by #15129 or #15137
Assignees
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@gyzerok
Copy link

gyzerok commented Jan 25, 2025

Describe the bug

After previous issue got fixed I've tried to update us again. The app is now rendering and there are no untrack related errors, however it looks like reactivity graph isn't properly connecting.

On the screenshots you can see how I both inspect one of our reactive values and log it using interval. When draft.attaches.isEmpty is changed interval starts outputting different value, however $inspect is never running again. And the only difference made to the repo is svelte dependency updated. With 5.19.0 everything works just fine.

Image Image

One more thing is that even in our codebase it's not 100% reproduceable in every place where draft.attaches.isEmpty is used. Somewhere it keeps working just fine and somewhere it breaks.

I think one last thing that is important - we are heavily using classes. So everything - root store, draft, attaches are all classes with $state runes inside.

Reproduction

For now I've spent some hours unsuccessfully hunting for the repro. So decided to open an issue anyway at least with these screenshots. Will keep hunting for the repro, but any help and guesses in the meantime are highly appreciated.

Logs

System Info

Svelte 5.19.2 or 5.19.3

Severity

blocking an upgrade

@Conduitry Conduitry added the awaiting submitter needs a reproduction, or clarification label Jan 25, 2025
@gyzerok gyzerok changed the title 5.19.2 (and 5.19.3) fixed untrack error, but breaks reactivity graph somewhere 5.19.2 (and 5.19.3) fixed untrack error, but reactivity graph is broken somewhere Jan 25, 2025
@trueadm
Copy link
Contributor

trueadm commented Jan 27, 2025

The fix you reference is for a genuine bug fix. If you're inside untrack, and you create a derived, it will now correctly be associated to the derived you're already in. That means that if that derived runs again, it will destroy the old derived that was there before – meaning it will no longer be connected to the reactivity graph. The derived can still run, it will just act like a regular function instead.

Previously, this was causing the deriveds created inside to "leak" and never get disconnected, which is why the bug fix was added around untrack.

@gyzerok
Copy link
Author

gyzerok commented Jan 29, 2025

For the future history will leave here a link to REPL where I finally managed to reproduce this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
3 participants