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 22, 2023
1 parent ab80342 commit 381abf6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 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
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const selectUserPatterns = createSelector(
categories: userPatternCategories,
};
},
( select, { search, syncStatus } = {} ) => [
( select ) => [
select( coreStore ).getEntityRecords( 'postType', PATTERN_TYPES.user, {
per_page: -1,
} ),
Expand All @@ -256,8 +256,6 @@ const selectUserPatterns = createSelector(
{ per_page: -1 },
] ),
select( coreStore ).getUserPatternCategories(),
search,
syncStatus,
]
);

Expand Down

0 comments on commit 381abf6

Please sign in to comment.