Skip to content

Commit

Permalink
Handle when the SET_HAS_CONTROLLED_INNER_BLOCKS block has been remove…
Browse files Browse the repository at this point in the history
…d from the state
  • Loading branch information
talldan committed Nov 21, 2024
1 parent 63d0d2f commit 773c76d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 773c76d

Please sign in to comment.