diff --git a/packages/block-editor/src/components/inserter/search-items.js b/packages/block-editor/src/components/inserter/search-items.js index 292d2bf95743b..d846f01eac955 100644 --- a/packages/block-editor/src/components/inserter/search-items.js +++ b/packages/block-editor/src/components/inserter/search-items.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { deburr, differenceWith, find, words } from 'lodash'; +import { deburr, find, words } from 'lodash'; // Default search helpers. const defaultGetName = ( item ) => item.name || ''; @@ -47,11 +47,11 @@ export const getNormalizedSearchTerms = ( input = '' ) => { }; const removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => { - return differenceWith( - unmatchedTerms, - getNormalizedSearchTerms( unprocessedTerms ), - ( unmatchedTerm, unprocessedTerm ) => - unprocessedTerm.includes( unmatchedTerm ) + return unmatchedTerms.filter( + ( term ) => + ! getNormalizedSearchTerms( + unprocessedTerms + ).some( ( unprocessedTerm ) => unprocessedTerm.includes( term ) ) ); };