Merge pull request #1490 from ghalestrilo/fix/mobile-crash-on-leave-preview

Fixes #1487
This commit is contained in:
Cassie Tarakajian 2020-07-06 15:20:39 -04:00 committed by GitHub
commit 97c3b3549c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

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