Skip to content
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

BUG Input event triggered when value prop is changed #89

Closed
Soviut opened this issue Feb 4, 2020 · 13 comments
Closed

BUG Input event triggered when value prop is changed #89

Soviut opened this issue Feb 4, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@Soviut
Copy link

Soviut commented Feb 4, 2020

I'm using the vue-currency-input in an app that uses Vuex. As such, I'm not using the v-model, I'm using a bound :value field to get Vuex state into the component and @input event to get updated values back out.

I have several currency fields and noticed they're all triggering their @input events when their :value changes, rather than just when someone inputs something in the field. This causes a cascade of fields to change.

I would expect that the @input only triggers when a human causes the input, the way regular form fields work.

I'll gladly try my hand at a PR if you agree.

@dm4t2
Copy link
Owner

dm4t2 commented Feb 4, 2020

Hi, which version do you use? This was originally fixed in 1.15.1.

@alipishevar
Copy link

I'm using the vue-currency-input in an app that uses Vuex. As such, I'm not using the v-model, I'm using a bound :value field to get Vuex state into the component and @input event to get updated values back out.

I have several currency fields and noticed they're all triggering their @input events when their :value changes, rather than just when someone inputs something in the field. This causes a cascade of fields to change.

I would expect that the @input only triggers when a human causes the input, the way regular form fields work.

I'll gladly try my hand at a PR if you agree.

Hi, which version do you use? This was originally fixed in 1.15.1.

version is updated...
I have the same problem

@Soviut
Copy link
Author

Soviut commented Feb 7, 2020

I believe I was using the most recent version

@dm4t2
Copy link
Owner

dm4t2 commented Feb 8, 2020

@Soviut: I can not reproduce this:
https://codesandbox.io/s/elated-sky-th2uz

If I change the state directly with Vue DevTools there's only a change triggered, rather than an input event. Please provide more information to reproduce. Feel free to fork my CodeSandbox.

@alipishevar
Copy link

@alex-w0
Copy link

alex-w0 commented Feb 11, 2020

@dm4t2 I've the same problem. On my example you can open the devtools and you will see that the message is logged before actually a change happened.
With version 1.15.1 the problem was solved.

https://codesandbox.io/s/upbeat-mountain-4mdek

@dm4t2
Copy link
Owner

dm4t2 commented Feb 15, 2020

@alipishevar I noticed in your example that the distraction free formatting gets lost each time the component's context changes. Is that your issue?

@DevelGitH So everything's fine or is there still an issue?

@alex-w0
Copy link

alex-w0 commented Feb 16, 2020

@dm4t2 only for the version 1.15.1
Would be glad if the bug will be resolved also for the newest version. In the meantime I've to use the old one or I will run into some conflicts with some other events.

@alipishevar
Copy link

@alipishevar I noticed in your example that the distraction free formatting gets lost each time the component's context changes. Is that your issue?

Yes of course

@Soviut
Copy link
Author

Soviut commented Feb 16, 2020

I was no using the distraction-free mode in mine, it was updating commas as you typed.

@dm4t2 I'll have to try again and see about using the difference between input and change events.

@dm4t2 dm4t2 added the bug Something isn't working label Feb 16, 2020
dm4t2 added a commit that referenced this issue Feb 16, 2020
- directive: dispatch input events on all value changes to sync value binding
- component: only emit input/change events on number value changes
@dm4t2
Copy link
Owner

dm4t2 commented Feb 16, 2020

The event handling issues should be fixed with Release 1.17.0 🎉

@dm4t2 dm4t2 closed this as completed Feb 16, 2020
@alex-w0
Copy link

alex-w0 commented Feb 17, 2020

The event handling issues should be fixed with Release 1.17.0 🎉

@dm4t2 Did you removed the events completely? The events on the component aren't working anymore. See my new issue

@dm4t2
Copy link
Owner

dm4t2 commented Feb 17, 2020

Unfortunately there was a bug not covered/detectable by the unit tests. Change events should be triggered correctly again with Release 1.17.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants