MainHeader: Ensure unmount doesn't double-remove on popperRoot

This commit is contained in:
Scott Nonnenberg 2019-12-04 14:30:36 -08:00 committed by Ken Powers
parent c5ea29d1f1
commit 3aff3ed181

View file

@ -127,7 +127,7 @@ export class MainHeader extends React.Component<PropsType, StateType> {
popperRoot: null,
});
if (popperRoot) {
if (popperRoot && document.body.contains(popperRoot)) {
document.body.removeChild(popperRoot);
}
};
@ -138,7 +138,7 @@ export class MainHeader extends React.Component<PropsType, StateType> {
document.removeEventListener('click', this.handleOutsideClick);
document.removeEventListener('keydown', this.handleOutsideKeyDown);
if (popperRoot) {
if (popperRoot && document.body.contains(popperRoot)) {
document.body.removeChild(popperRoot);
}
}