Skip to content

Commit

Permalink
Fix: Missing 'No blocks found.' message for block search in editor (#…
Browse files Browse the repository at this point in the history
…69036)


Co-authored-by: Rishit30G <rishit30g@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent fa5a02e commit 0ee04b1
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
FlexItem,
SearchControl,
__experimentalHStack as HStack,
__experimentalText as Text,
} from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import {
Expand Down Expand Up @@ -140,12 +141,18 @@ function BlockList( { filterValue } ) {
// By default, BlockMenuItem has a role=listitem so this div must have a list role.
role="list"
>
{ filteredBlockTypes.map( ( block ) => (
<BlockMenuItem
block={ block }
key={ 'menu-itemblock-' + block.name }
/>
) ) }
{ filteredBlockTypes.length === 0 ? (
<Text align="center" as="p">
{ __( 'No blocks found.' ) }
</Text>
) : (
filteredBlockTypes.map( ( block ) => (
<BlockMenuItem
block={ block }
key={ 'menu-itemblock-' + block.name }
/>
) )
) }
</div>
);
}
Expand Down

0 comments on commit 0ee04b1

Please sign in to comment.