Skip to content

Commit

Permalink
Bail early if no proper block
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jul 31, 2018
1 parent ad147db commit 707fc7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -587,7 +591,7 @@ const unfoldClientIds = ( state, block ) => {
return [ null ];
};
const getClientIdsFromInnerBlock = ( globalState ) => ( innerBlock ) => [
innerBlock.clientId,
get( innerBlock, [ 'clientId' ], null ),
...unfoldClientIds( globalState, innerBlock ),
];
return [
Expand Down

0 comments on commit 707fc7a

Please sign in to comment.