Skip to content

Commit

Permalink
add deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Jun 26, 2023
1 parent 3c789cd commit f1a7a41
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ const InserterDraggableBlocks = ( {
blocks,
};

const blockType = useSelect( ( select ) => {
const { getBlockType } = select( blocksStore );
return blocks.length === 1 && getBlockType( blocks[ 0 ].name );
} );
const blockTypeIcon = useSelect(
( select ) => {
const { getBlockType } = select( blocksStore );
return (
blocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon
);
},
[ blocks ]
);

return (
<Draggable
Expand All @@ -36,7 +41,7 @@ const InserterDraggableBlocks = ( {
__experimentalDragComponent={
<BlockDraggableChip
count={ blocks.length }
icon={ icon || ( ! isPattern && blockType?.icon ) }
icon={ icon || ( ! isPattern && blockTypeIcon ) }
isPattern={ isPattern }
/>
}
Expand Down

0 comments on commit f1a7a41

Please sign in to comment.