fix console error with FindDOMNode() on unmounted component
This commit is contained in:
parent
ae883f1065
commit
01a250e5b7
@ -105,13 +105,15 @@ class Dropdown extends Component {
|
||||
}
|
||||
|
||||
handleWindowClick(event) {
|
||||
const dropdownElement = findDOMNode(this);
|
||||
const shouldUpdateState = event.target !== dropdownElement &&
|
||||
if(this.state.isOpen){
|
||||
const dropdownElement = findDOMNode(this);
|
||||
const shouldUpdateState = event.target !== dropdownElement &&
|
||||
!dropdownElement.contains(event.target) &&
|
||||
this.state.isOpen;
|
||||
|
||||
if (shouldUpdateState) {
|
||||
this.handleHide();
|
||||
if (shouldUpdateState) {
|
||||
this.handleHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user