diff --git a/assets/js/blocks/cart-checkout-shared/use-forced-layout/index.ts b/assets/js/blocks/cart-checkout-shared/use-forced-layout/index.ts index 8aeeb49b2f5..9df07cf3c4b 100644 --- a/assets/js/blocks/cart-checkout-shared/use-forced-layout/index.ts +++ b/assets/js/blocks/cart-checkout-shared/use-forced-layout/index.ts @@ -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 );