From c9b8f8533a9951de6f12e758ffa5ae690bd7ddf9 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Fri, 9 Dec 2022 14:48:19 +0200 Subject: [PATCH] Lodash: Refactor blocks away from _.find() --- packages/blocks/src/store/reducer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/blocks/src/store/reducer.js b/packages/blocks/src/store/reducer.js index 29bd7c9ef02aa7..16f95127137a52 100644 --- a/packages/blocks/src/store/reducer.js +++ b/packages/blocks/src/store/reducer.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { find, get, isEmpty, map, mapValues } from 'lodash'; +import { get, isEmpty, map, mapValues } from 'lodash'; /** * WordPress dependencies @@ -265,7 +265,9 @@ export function categories( state = DEFAULT_CATEGORIES, action ) { if ( ! action.category || isEmpty( action.category ) ) { return state; } - const categoryToChange = find( state, [ 'slug', action.slug ] ); + const categoryToChange = state.find( + ( { slug } ) => slug === action.slug + ); if ( categoryToChange ) { return map( state, ( category ) => { if ( category.slug === action.slug ) {