Fix crash in WooExpress Cart & Checkout Editor (https://github.com/woocommerce/woocommerce-blocks/pull/11024)

This commit is contained in:
Saad Tarhi 2023-09-22 19:10:50 +01:00 committed by GitHub
parent a7b5812703
commit 13024c88e6
1 changed files with 9 additions and 0 deletions

View File

@ -46,6 +46,15 @@ export const useForcedLayout = ( {
const { replaceInnerBlocks } = dispatch( 'core/block-editor' );
return registry.subscribe( () => {
const currentBlock = registry
.select( 'core/block-editor' )
.getBlock( clientId );
// If the block is removed we shouldn't reinsert its inner blocks.
if ( ! currentBlock ) {
return;
}
const innerBlocks = registry
.select( 'core/block-editor' )
.getBlocks( clientId );