-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
When a reactive assignment in a child component try to update a value bound with "bind" directive, and its parent try to update the same value in a "conflicting" reactive assignment. The value in the parent end up to be different from the one in the child component.
To Reproduce
https://svelte.dev/repl/71e978db32d34e25918ed2d196768ea5?version=3.32.1
Expected behavior
Maybe the best result would be to try keep update the child value with the one set by the parent paying attention that this would lead to execute the reactive declaration in the child (Imagine i would set counter to 2 from the parent in my example) and that would bring us a in loop.
I mean, in this case probably to get and infinite loop is more correct than getting two different values.
In order to prevent infinite loop Svelte may keep track of the cause of the execution of a reactive declaration (or any other reactive expression) and throw an error if it detects cyclical updates.
Severity
It's not a bad issue. I think you are likely to encounter this issue when in a child you use reactive assignments to check a bad input value and try to fix it.