-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
$derived vs function in each block #14991
Comments
closes #14991 - at least to the extent possible Also adjusts a comment which a) did not hint at why it's needed in the first place (was added in #14967) b) sounded like we could change that in the future, but we can't, because people will always have the ability to trigger reactivity through other means without changing the array reference
Has this since been fixed now? |
No, there's still a double invocation, the question is whether or not we can safely remove the second get call at the end of the each function, which would resolve this |
@dummdidumm Looks like we can't due to each blocks being special in that they mutate state internally which can cause the graph to become unstable. |
Yeah I reckon it’s fixed with v5.17.4 |
Describe the bug
I'm not sure if this is a bug or just something to discuss.
Essentially if I use a function directly in the
each
block, the functionsplitItem()
is triggered twice whenever the item is mutated:However it's as expected if I use $derived -
splitItem()
is called once when the item is changed. So I'm wondering why prop change triggered the callback twice in A.svelte?Reproduction
Playground
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: