-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Name collision in each disables binding #4757
Comments
This doesn't seem like a bug. That just stops bad habits. As this is now a set that contains itself? Why exactly is it a bug that your not allowed to use the same variable name to do a different thing with what it contains? |
const id = {
I assume that the result of destruction in new scope like inside block of each loop |
<script>
let a = [
'Hello'
];
</script>
{#each a as a}
{a}
<input bind:value={a} />
{/each} also doesn't work it looks like, so I don't think this is specific to destructuring. I sort of feel there was another issue for this at some point (which I don't recall whether it was closed or not) but if it existed I cannot find it now. |
@sylcai I think it kinda is a bug since on the initial render, the Not sure if this is something that should be fixed or if there should just be a warning/error if you try to do this? |
This is fixed in 3.23.1. |
Describe the bug
Name collision between expression name and property name in destructed object disables bind to work on that property
To Reproduce
https://svelte.dev/repl/d4fe2df9f4474da985dd2c6afa6876f3?version=3.21.0
Expected behavior
Property inside an object should change when input changed
Information about your Svelte project:
Severity
Annoying. Of course that applieable in very small cases but i think it should work
Workaround
Renaming the property name fix problem
Would work
The text was updated successfully, but these errors were encountered: