diff --git a/blocks/library/embed/index.js b/blocks/library/embed/index.js index 519fd2ff1403f..3a3a35b485c72 100644 --- a/blocks/library/embed/index.js +++ b/blocks/library/embed/index.js @@ -91,6 +91,11 @@ registerBlock( 'core/embed', { } } + componentWillUnmount() { + // can't about the fetch promise, so let it know we will unmount + this.unmounting = true; + } + doServerSideRender( event ) { if ( event ) { event.preventDefault(); @@ -103,6 +108,9 @@ registerBlock( 'core/embed', { credentials: 'include', } ).then( ( response ) => { + if ( this.unmounting ) { + return; + } response.json().then( ( obj ) => { const { html, type } = obj; if ( html ) {