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) {