diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js index 6e498ca1c31a6c..aad87a7b027053 100644 --- a/packages/editor/src/store/selectors.js +++ b/packages/editor/src/store/selectors.js @@ -576,6 +576,10 @@ export const getBlocks = createSelector( * @return {Array} ids of referenced and inner blocks. */ const unfoldClientIds = ( state, block ) => { + if ( ! block ) { + return [ null ]; + } + const getClientIdsFromSharedBlock = ( globalState, sharedBlock ) => { if ( sharedBlock.name === 'core/block' ) { const clientId = get( getSharedBlock( globalState, sharedBlock.attributes.ref ), [ 'clientId' ], null ); @@ -587,7 +591,7 @@ const unfoldClientIds = ( state, block ) => { return [ null ]; }; const getClientIdsFromInnerBlock = ( globalState ) => ( innerBlock ) => [ - innerBlock.clientId, + get( innerBlock, [ 'clientId' ], null ), ...unfoldClientIds( globalState, innerBlock ), ]; return [