From 3aff3ed1811627d70fd7ce72b98f854b179a832f Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 4 Dec 2019 14:30:36 -0800 Subject: [PATCH] MainHeader: Ensure unmount doesn't double-remove on popperRoot --- ts/components/MainHeader.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/components/MainHeader.tsx b/ts/components/MainHeader.tsx index 66d4ba59f88..68eaaf3c92f 100644 --- a/ts/components/MainHeader.tsx +++ b/ts/components/MainHeader.tsx @@ -127,7 +127,7 @@ export class MainHeader extends React.Component { popperRoot: null, }); - if (popperRoot) { + if (popperRoot && document.body.contains(popperRoot)) { document.body.removeChild(popperRoot); } }; @@ -138,7 +138,7 @@ export class MainHeader extends React.Component { document.removeEventListener('click', this.handleOutsideClick); document.removeEventListener('keydown', this.handleOutsideKeyDown); - if (popperRoot) { + if (popperRoot && document.body.contains(popperRoot)) { document.body.removeChild(popperRoot); } }