-
-
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
Input binding wrongly triggers reactivity of a variable used in it's bind path computation #5156
Comments
I do have the same problem on the last svelte version using inputs from https://github.com/matyunya/smelte. |
I can reproduce this issue with version 3.23.2 as well: https://svelte.dev/repl/4080ea1bee0249fba011f3f25707dbd8?version=3.23.2 |
Hello, I have the same issue on latest version 3.25 as well : https://svelte.dev/repl/ea825f47db4e44b1b29864ebe2f61e34?version=3.25.1 When using a simple string it works as expected but using an object will trigger reactivity on the object and not only its property. |
Here is another example that triggers this behaviour: |
This comes down to
Svelte 5 fixes this by separating these into two distinct runes, |
Describe the bug
When we bind an input to a object property, and if we use an expression to compute that property name, binding not only triggers reactivity of containing object, but also other other objects used in it's property-path computation. For example, if we say
<input bind:value={form[schema.name]}>
, changing input not only triggers reactivity overform
object, but also onschema
object used in property name computation.And if we declare to reset
form
onschema
change, that will be mis-triggered on value change to above binding, and effectively resets form, and binding itself again.To Reproduce
Here is REPL. Try to input in field, and we can see reactivity mis-triggering on
schema
.Expected behavior
should not trigger reactivity on other objects used in expression to compute property path.
Severity
Seems serious.
Additional context
Possibly related issues:
#4448 , #4933
The text was updated successfully, but these errors were encountered: