Skip to content

Commit

Permalink
Patterns: fix bug with Create Patterns menu not showing in site edito…
Browse files Browse the repository at this point in the history
…r page editing (#52671)

* Pass the root client id into the reusable blocks menu

* Check that clientIds array is defined

* Make check for array item more specific
  • Loading branch information
glendaviesnz authored Jul 18, 2023
1 parent 3c34c48 commit dd1f05b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ function ReusableBlocksMenuItems( { clientIds, rootClientId } ) {
}

export default withSelect( ( select ) => {
const { getSelectedBlockClientIds } = select( blockEditorStore );
const { getSelectedBlockClientIds, getBlockRootClientId } =
select( blockEditorStore );
const clientIds = getSelectedBlockClientIds();
return {
clientIds: getSelectedBlockClientIds(),
clientIds,
rootClientId:
clientIds?.length > 0
? getBlockRootClientId( clientIds[ 0 ] )
: undefined,
};
} )( ReusableBlocksMenuItems );

0 comments on commit dd1f05b

Please sign in to comment.