Prevents using both bind:value
and on:change
on the same elem (particularly input)
#1058
Labels
bind:value
and on:change
on the same elem (particularly input)
#1058
Motivation
We've found that using both at the same time is prone to mistake because, if
on:change
is used, it's likely the function would lead to updating the value. This can lead to a bug in some cases.In my case, I use
on:change
to fire an ajax request to update the field and then I'd update the value of the input. However, I accidentally usedbind:value
and the value was updated even before the ajax request is fired. We only discovered a small bug (but still a bug) because the ajax request failed, an error message was shown, but the value has been updated on the UI (throughbind:value
) already.While I like the convenience of
bind:value
, compared to React, there's no ambiguity because it doesn't supportbind:value
. This makes me realize that maybe it is a good practice to not use bothbind:value
andon:change
at the same time.Description
Prevent the usage of
bind:value
andon:change
on the same input elem.Examples
Additional comments
No response
The text was updated successfully, but these errors were encountered: