Skip to content

Commit

Permalink
Optimize check for nullish rootChildBlocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebulanStanphill committed Jun 6, 2020
1 parent 9929192 commit 86c0095
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/block-editor/src/components/inserter/block-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ export function InserterBlockList( {
}, [ filterValue, items, categories, collections ] );

const childItems = useMemo( () => {
return filteredItems.filter( ( { name } ) =>
rootChildBlocks?.includes( name )
);
return rootChildBlocks
? filteredItems.filter( ( { name } ) =>
rootChildBlocks?.includes( name )
)
: [];
}, [ filteredItems, rootChildBlocks ] );

const suggestedItems = useMemo( () => {
Expand Down

0 comments on commit 86c0095

Please sign in to comment.