-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: $effect
somewhat broken between v247 and v248
#13296
Comments
So it works in 247 but it's broken in 248? |
Correct |
Yup, reverting #13274 locally fixes the repl...my guess is that the effect in the But i think @trueadm will fix this easily so i will not try to fix it 😄 EDIT: forcing the read in the script by loggin data "fixes" the issue so i guess i'm kinda right repl |
literally wanna ask this on my issue, but having second thoughts because I haven't test it yet @brunnerh |
This is a complicated one. It’s technically working correctly now, whilst incorrect before. The derived is lazy, so where you access it matters, especially if it creates an effect. So using it inside the template will associate the inner effect with whatever effect the derived was used in. However, this isn’t ideal in this use case. I need to think about this more |
I was thinking: deriveds likely needs to be attached to the component effect, so what if we store the effect to the derived itself on the declaration and we set the active effect when we call it? Could this work? |
They used to be, but that's actually wrong. If you read a derived inside another |
Actually I think there might be another issue at play here, digging into it now. |
Missed this comment when I was noodling on this problem earlier, but yes, this is the exact right solution |
Describe the bug
A dependency seems to not be tracked correctly in certain scenarios.
The example uses a
$derived.by
to destructure props from a stateful object updated via$effect
.Reproduction
REPL
The
data
updates initially, but changing the index does not re-trigger past v247.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: