-
Notifications
You must be signed in to change notification settings - Fork 97
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
Not triggering props.onChange initially and when props.value changes + Old props.onChange gets triggered #55
Comments
|
Please, try a new pre-release 1.0.4-beta1 |
Thanks Igor, I will test and update. |
Hi Igor, Thanks the change works for my use case. Just a comment though. Should not it be 'prevProps' that are passed to this.detachEventHandlers() in updSelect2(). With the existing code you now cannot detach the handlers by simply not setting the corresponding props (onChange, onSelect ..)
Also on #1 from the issue, |
Oh, yes, you're right, but you mean
Yes, now I understand. I agree this needs to be fixed. |
I meant prevProps. Say for the first render you passed updSelect2(props) - if you do |
Yes, I meant the same. Should be
I will fix it soon. Thanks for the report. |
Please, try a new pre-release 1.0.4-beta2 |
@rkit seems to work here, edit2: seemed to be the regular dropdown in same form as my multiselect which went on a loop when new props triggered change event. I changed dropdown to using onSelect and multiselect to use onChange which seems to work. The unrelated note: onUnSelect seems to trigger react unknown prop warning |
Is it possible to not trigger the props.onChange() when Select2 is rendered the very first time or when props.value() is explicitly changed ?
When I update both the props.value & props.onChange(), it calls the previously set change handler.
This seems to be because the setValue() call in componentWillReceiveProps() triggers the change event and the componentWillUpdate() lifecycle method updates the handlers. Is there a particular reason why we update value in componentWillReceiveProps() ?
https://github.com/rkit/react-select2-wrapper/blob/master/src/components/Select2.js#L54-L58
The text was updated successfully, but these errors were encountered: