-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Click event triggering twice. #4101
Comments
Hi @oakkar8, thanks for writing in. Could you please provide a example video of the issue, as well as tell us which browser you're using? Thanks! |
i am using chrome. |
The behavior is as you described in the video, but it also seems inconsistent with the behavior I'm seeing locally let alone the first example on the site's documentation. Would you mind providing sample code so we could see what props are being used as we'd like to help discover any discrepancies between your code and the other examples. |
The example has also the same bug.. try with inspect mode and choose one of the phone size and try the example.. you will see as the video. |
Confirmed. I am able to replicate the behavior by going to Chrome DevTools > Toggle device toolbar (top left corner of window) and when emulating as Responsive. A press on the ClearIndicator activates the Menu. |
More information on this: Appears that I am getting an error in the console:
Which ironically is a typo/bug in Chrome as the actual url is:
Looking further into this, it appears that this is not isolated to this particular instance, but with React as it uses synthetic events to register the event bindings. |
Thanks for investigating and the detail @ebonow. |
It's possible @getaaron, we'll investigate. |
This can be pretty bad if you have a function that runs using the data passed back from the event. This function will now run twice which can lead to weird stuff. In my case it compared the data with the previous cached data. First it checked which field had changed to then update that in the store and database. But when the second event fires, the cache has already been updated. As the function did not account for no field having changed, this lead to an error in the app. Happens in react-select v4.0.0 |
@barbalex Thanks for confirming that this is still an issue in v4. We would be happy to look at any PR's for this and I'll keep an eye on this. |
react-select : 3.1.0
react: 16.11.0
In small screen mode, when i click the clear icon, the menu box also opens up..
The text was updated successfully, but these errors were encountered: