-
-
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
object on right side of = operant in reactive statement is updated, when variable on left side is changed by bind:value, while variable doesn't change #7045
Comments
I'm not sure what behaviour it is that you expect. "$; foo = bar.a" means that you expect foo to always be whatever bar.a is, and "bind:value={foo}" means that you expect foo to to be whatever has been entered in the input. It can't be both! Maybe svelte should raise an error to stop any attempt to bind to a reactive value, instead of allowing it to work (albeit with likely undesired behaviour) |
is not true... this means, value of foo is set to same as value of bar.a, whenever bar.a change... means, foo can be different than bar.a, if foo is changed, because it doesn't change bar.a so reactive statement is not executed so, foo should have value from bind:value. And this works correctly, if not using bind:value,.. see example with setTimeout(): https://svelte.dev/repl/707142058b574f3eb1e674f72551b19f?version=3.44.3 E: and this is correct behaviour, that should work also with bind:value and object properties. E: Interesting,... robertadamsonsmirth answered totally incorrect answer and got thumb up emoji, even tho, right here is proof, they were incorrect. |
#4933, sounds like the third point there |
Yes, this is confusing. It's not clear why you're not able to change ... depending on your mental model of how you expect reactive statements to work, as discussed in #4933. If you expect This behavior was introduced by #2444 in Svelte 3.2.1+, so if you run your first example using 3.2.0 (https://svelte.dev/repl/60487dd8d6f941b3bc2e0d72124a2abb?version=3.2.0), you'll see that it did indeed use to allow you to change the foo input independently, and then only reset foo based on your |
This comes down to
Svelte 5 fixes this by separating these into two distinct runes, |
Hello, anyone have any ideas how to solve this in Svelte 3? I don't want the right side of a |
Update: I managed to solve this by doing the following:
now |
Describe the bug
change
foo
(type something to input foo), it will updatebar.a
,foo
is blocked, will not change text in input.Reproduction
https://svelte.dev/repl/60487dd8d6f941b3bc2e0d72124a2abb?version=3.44.3
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: