Update state when opened dropdown is unmounted (fixes #8397)

This commit is contained in:
Thibaut Girka 2018-08-23 20:19:50 +02:00
parent 5b5ae01824
commit dcd3544d15

View File

@ -226,6 +226,12 @@ export default class Dropdown extends React.PureComponent {
return this.target; return this.target;
} }
componentWillUnmount = () => {
if (this.state.id === this.props.openDropdownId) {
this.handleClose();
}
}
render () { render () {
const { icon, items, size, title, disabled, dropdownPlacement, openDropdownId } = this.props; const { icon, items, size, title, disabled, dropdownPlacement, openDropdownId } = this.props;
const open = this.state.id === openDropdownId; const open = this.state.id === openDropdownId;