Skip to content

Commit

Permalink
Story Block: be more defensive to avoid error in block previews (#39807)
Browse files Browse the repository at this point in the history
Fixes #39694
  • Loading branch information
jeherve authored Oct 18, 2024
1 parent 7512e82 commit ab0df3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-story-block-fatal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Story Block: avoid error when previewing block styles in development version of the Gutenberg plugin.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ class Modal extends Component {
* Removes the specific mounting point for this modal from the DOM.
*/
cleanDOM() {
parentElement.removeChild( this.node );
if ( this.node && parentElement && parentElement.contains( this.node ) ) {
parentElement.removeChild( this.node );
}
this.node = null;
}

/**
Expand Down

0 comments on commit ab0df3c

Please sign in to comment.