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

Multiple On Change Events #74

Closed
JeffBeltran opened this issue Apr 14, 2018 · 1 comment
Closed

Multiple On Change Events #74

JeffBeltran opened this issue Apr 14, 2018 · 1 comment
Labels

Comments

@JeffBeltran
Copy link

I'm submitting a ... (check one with "x")

[X] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • flatPickr version : 4.x.x
  • Vue.js version : 2.1.x
  • Browser name and version : Chrome
  • This package version : 7

Current behavior
When i have two compoents on the same page if i change the second one it triggers the @on-change event twice

Expected behavior
should only trigger the event for the value that was updated

Minimal reproduction of the problem with instructions
https://jsfiddle.net/sedyybb7/

on that fiddle if you change the first one you will only get the 1 alert but if you change the 2nd one it will alert twice, for each component

Looks like #27 might be similar but as you can see from the fiddle it is still not working, not sure if it's the way im doing it? or if a bug.

As always, thanks for your time and creating this helpful package

@ankurk91
Copy link
Owner

ankurk91 commented Apr 14, 2018

@JeffBeltran
Thanks for catching this issue.
I will be releasing a new version soon (may be tomorrow).

What was the actual cause?

Same config object (via prop) was being used for two components. And each component was mutating this object.

How is fixed this issue?

Clone the config object before mutating it.

Meanwhile you can test the updated fiddle.
https://jsfiddle.net/sedyybb7/4/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants