-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Svelte 5: Chained $derived
s don't update sometimes
#11481
Comments
Started exploring this: definitely looks like a bug, the moment you access either of |
It feels like a more elaborate version of #11364 . given that now there are two signals that are unchanged maybe that make a difference? |
dummdidumm
added a commit
that referenced
this issue
May 7, 2024
Deriveds where under certain conditions not detected as dirty correctly. The reason is that a transitive check_dirtiness call could update the flag of a derived, even if the condition doesn't ulimately result to true. That's why the check for "is now dirty" needs to be moved out of the inner if block. Fixes #11481 This may also fix a yet undetected overfiring bug in the "is unowned" case because the previous inner "is now dirty?" check didn't take unowned into account.
5 tasks
Rich-Harris
pushed a commit
that referenced
this issue
May 7, 2024
Deriveds where under certain conditions not detected as dirty correctly. The reason is that a transitive check_dirtiness call could update the flag of a derived, even if the condition doesn't ulimately result to true. That's why the check for "is now dirty" needs to be moved out of the inner if block. Fixes #11481 This may also fix a yet undetected overfiring bug in the "is unowned" case because the previous inner "is now dirty?" check didn't take unowned into account.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I know it's not particularly helpful but the reproduction is the best explainer for this. Essentially it seems chaining multiple deriveds causes state to not update even though it should if one of the older derived's value's didn't change. The provided reproduction is as minimal as I could get it with it still occurring.
If you are experiencing this bug, figure out which state isn't updating correctly and try put that last in the $derived block that should be receiving updates but isn't, or reduce the number of $deriveds you're using.
$inspect
fixes the problem, but remember it won't work in production.Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA21SX0_jMAz_KlaEdC2H6Ab3tGuH-AycxMP1HtLWY9HSJIrd7aZp3x2nK1AQT63t3x_b8UltjEVSq78n5XSPaqUeQ1A3io8hBbRHyygx-SG2KVNSG03gde1qtshAWz_Y7mnrD4slVHBFrBmzjbaE-W8BCawo4HkrNsBbQ0CIPYE1OwQNe4xHGFyK7DHV3QuwTxgwTuqt77DRhDeTTsQe-wajQDVDiD7ANf4PEYmMd3QNOqKQ-iB2nUiI1tVth9HsJWysb3c0KZEHwyQWjWHovdDem9BOSkI2bLSVzNjxbeK9DS2K47CTcjZfQj4ZSO0O-oESOqDrwLsLT8t_svYDh-Ftge4HQyvOLzjzuJt7pBfxm8m6qqBWxFH2Vat8RrmfU0aJB0EuawUr-S4-g3_NweN8qfGngw6yBQQfpTa1Cwcfd9MSePT5CdnYy3f66eXL4uNSXBnWp2R4LotwSTQDs2zEu9aadledshyqNWRfzonjgPl5_SemV-B0GotlWVy4oiOH2fvObAx2apWw53_nVz_5oyDTAgAA
Logs
No response
System Info
System: OS: Linux 6.6 NixOS 24.05 (Uakari) 24.05 (Uakari) CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900HX Memory: 17.66 GB / 31.20 GB Container: Yes Shell: 5.2.26 - /run/current-system/sw/bin/bash Binaries: Node: 20.11.1 - /nix/store/vz13mi0w75q96sfjxz2ylnv8812hvf34-nodejs-20.11.1/bin/node npm: 10.2.4 - /nix/store/vz13mi0w75q96sfjxz2ylnv8812hvf34-nodejs-20.11.1/bin/npm pnpm: 8.15.3 - /etc/profiles/per-user/dooshii/bin/pnpm Browsers: Chromium: 122.0.6261.94 [Not listed: Firefox DevEdition: 124.0b5] npmPackages: svelte: 5.0.0-next.123 => 5.0.0-next.123
Severity
annoyance
The text was updated successfully, but these errors were encountered: