From 0b0dd3081ec28dd58f518e81334fbba9fed12f25 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Tue, 19 Sep 2023 16:16:22 +0800 Subject: [PATCH] Revert memoized selector in resolver --- packages/core-data/src/resolvers.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index 35b04f0d71f886..e01bb12b2e253c 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -2,7 +2,6 @@ * External dependencies */ import { camelCase } from 'change-case'; -import createSelector from 'rememo'; /** * WordPress dependencies @@ -620,15 +619,6 @@ export const getBlockPatternCategories = dispatch( { type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES', categories } ); }; -const mapPatternCategories = createSelector( - ( patternCategories ) => - patternCategories?.map( ( userCategory ) => ( { - ...userCategory, - label: userCategory.name, - name: userCategory.slug, - } ) ) || [] -); - export const getUserPatternCategories = () => async ( { dispatch, resolveSelect } ) => { @@ -641,9 +631,16 @@ export const getUserPatternCategories = } ); + const mappedPatternCategories = + patternCategories?.map( ( userCategory ) => ( { + ...userCategory, + label: userCategory.name, + name: userCategory.slug, + } ) ) || []; + dispatch( { type: 'RECEIVE_USER_PATTERN_CATEGORIES', - patternCategories: mapPatternCategories( patternCategories ), + patternCategories: mappedPatternCategories, } ); };