-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Reassigning bindable prop will lose reactivity in parent #15879
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
Ok darn that makes sense. I completely overlooked that fact because it works when manipulating the object. Is this then intended behaviour? Should that relation not be immutable if there is no explicit |
If the prop is not |
That makes sense, and I agree, maybe we could throw a warning saying we're trying to manipulate a $bindable object that doesn't have But is there a use-case where we want |
It's just however the developer of the parent component chooses to use the child component. If the parent component doesn't intend to use |
Describe the bug
When you pass a $state with an object as a $binable prop, and you re-assign that prop to a new object in the child, the parent will not pick up on the change.
Reproduction
https://svelte.dev/playground/c67f404b51e24509ab99a256950ffd7a?version=5.28.2
Click Add a few times, both $inspects will show the correct list, but when clicking Remove, only the
Component.svelte
will output,App.svelte
will not be aware of the change.Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: