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

Events not firing if using setState on event #7

Open
jeffchan opened this issue Aug 4, 2014 · 1 comment
Open

Events not firing if using setState on event #7

jeffchan opened this issue Aug 4, 2014 · 1 comment

Comments

@jeffchan
Copy link

jeffchan commented Aug 4, 2014

I am using a slightly modified version to detect when the Chosen dropdown has closed (chosen:hiding_dropdown event).
When I select an option from the dropdown, Chosen fires two events, "chosen:hiding_dropdown" and "change." However, in React, only one event shows up.

You can see the reproduction here http://jsfiddle.net/jeffchan/vySpj/

Steps to reproduce:

  1. Select an option from the dropdown
  2. Check the console output.

Expected:
show dropdown
hide dropdown
handle change

Actual:
show dropdown
hide dropdown

original: https://groups.google.com/d/msgid/reactjs/cd78a2fb-2c6d-406c-b0b4-1ec8ce869308%40googlegroups.com?utm_medium=email&utm_source=footer

@chenglou
Copy link
Owner

chenglou commented Aug 4, 2014

(Cross-posted from google groups)

I just checked it and I think it's because you did a setState after the events fired. If you remove the setState, it works fine.
Messing with the combination of jquery events, chosen's hacky dom manipulations and react's setState is not fun at all.

I wish we have an acceptable react-only chosen substitute now. Oh well.

(Will solve it if I have the time)

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

No branches or pull requests

2 participants