-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Binding causes extra reactive call in child #8184
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
Comments
The initial double logging sounds like #5689 The double logging when clicking the button seems to be caused by Edit:
|
Sorry, I just edited the repro (now it's My use case was to have updates to Edit: From what I understand, those issues were temporarily fixed from v3.54.0 to v3.55.0 but that doesn't seem to be the case for this issue: https://svelte.dev/repl/2b38363381f6400b9b9a8a870fbb7b24?version=3.54.0 |
To be clear, based on #6298 (comment), this behavior isn't really a bug and instead an example of conservative reactivity. I just wanted to document the reproduction and the |
You are right, but it did change the initial logging behavior (the fix was for initial binding after all) Twice: https://svelte.dev/repl/2b38363381f6400b9b9a8a870fbb7b24?version=3.53.1 |
This will be fixed in Svelte 5 |
Describe the bug
When a reactive statement is triggered in a child component, if another non-primitive dependency of that statement is bound to the parent component, the reactive statement will be run an extra time.
Ran into this when trying to use the Broadcast Channel API to sync bound Svelte variables across tabs. The extra call would cause infinite loops in sending messages between tabs.
Similar to #5720 but without the slot.
One workaround is to add
<svelte:options immutable/>
to the child component.Reproduction
https://svelte.dev/repl/2b38363381f6400b9b9a8a870fbb7b24?version=3.55.1
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: