diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js index 5b9875b056f4b4..5a7c532367dbe8 100644 --- a/packages/block-editor/src/store/reducer.js +++ b/packages/block-editor/src/store/reducer.js @@ -2563,14 +2563,18 @@ export function withDerivedBlockEditingModes( reducer ) { break; } case 'SET_HAS_CONTROLLED_INNER_BLOCKS': { - const newControlledBlock = nextState.blocks.tree.get( + const updatedBlock = nextState.blocks.tree.get( action.clientId ); + // The block might have been removed. + if ( ! updatedBlock ) { + break; + } const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates( { prevState: state, nextState, - addedBlocks: [ newControlledBlock ], + addedBlocks: [ updatedBlock ], } ); if ( nextDerivedBlockEditingModes ) {