Skip to content

Commit

Permalink
Revert memoized selector in resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Sep 19, 2023
1 parent 1a6c423 commit 0b0dd30
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import { camelCase } from 'change-case';
import createSelector from 'rememo';

/**
* WordPress dependencies
Expand Down Expand Up @@ -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 } ) => {
Expand All @@ -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,
} );
};

Expand Down

0 comments on commit 0b0dd30

Please sign in to comment.