From 835a553bf93862e616f20333d2bfe98c689d655c Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Fri, 3 Jul 2020 14:40:20 -0300 Subject: [PATCH] :bug: check for own iframe body tag before unmounting it --- client/modules/IDE/components/PreviewFrame.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/components/PreviewFrame.jsx b/client/modules/IDE/components/PreviewFrame.jsx index 3b193a8f..ef33bb3f 100644 --- a/client/modules/IDE/components/PreviewFrame.jsx +++ b/client/modules/IDE/components/PreviewFrame.jsx @@ -64,7 +64,8 @@ class PreviewFrame extends React.Component { componentWillUnmount() { window.removeEventListener('message', this.handleConsoleEvent); - ReactDOM.unmountComponentAtNode(this.iframeElement.contentDocument.body); + const iframeBody = this.iframeElement.contentDocument.body; + if (iframeBody) { ReactDOM.unmountComponentAtNode(iframeBody); } } handleConsoleEvent(messageEvent) {