Skip to content

Commit

Permalink
Fix flipped hasItems value
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Sep 23, 2019
1 parent 95e769d commit fcb5f74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,10 @@ export class InserterMenu extends Component {
openPanels,
reusableItems,
suggestedItems,
filterValue,
} = this.state;
const isPanelOpen = ( panel ) => openPanels.indexOf( panel ) !== -1;
const hasItems = isEmpty( suggestedItems ) && isEmpty( reusableItems ) && isEmpty( itemsPerCategory );
const hasItems = ! ( isEmpty( suggestedItems ) && isEmpty( reusableItems ) && isEmpty( itemsPerCategory ) );
const hoveredItemBlockType = hoveredItem ? getBlockType( hoveredItem.name ) : null;

// Disable reason (no-autofocus): The inserter menu is a modal display, not one which
Expand Down Expand Up @@ -362,15 +363,15 @@ export class InserterMenu extends Component {
fillProps={ {
onSelect,
onHover: this.onHover,
filterValue: this.state.filterValue,
filterValue,
hasItems,
} }
>
{ ( fills ) => {
if ( fills.length ) {
return fills;
}
if ( hasItems ) {
if ( ! hasItems ) {
return (
<p className="editor-inserter__no-results block-editor-inserter__no-results">{ __( 'No blocks found.' ) }</p>
);
Expand All @@ -381,7 +382,7 @@ export class InserterMenu extends Component {
</div>
</div>

{ showInserterHelpPanel && (
{ hasItems && showInserterHelpPanel && (
<div className="block-editor-inserter__menu-help-panel">
{ hoveredItem && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function InserterMenuDownloadableBlocksPanel() {
<__experimentalInserterMenuExtension>
{
( { onSelect, onHover, filterValue, hasItems } ) => {
if ( ! hasItems ) {
if ( hasItems ) {
return null;
}

Expand Down

0 comments on commit fcb5f74

Please sign in to comment.