Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions packages/block-library/src/query/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ import { store as coreStore } from '@wordpress/core-data';
* @param {WPTerm[]} terms The terms to extract of helper object.
* @return {QueryTermsInfo} The object with the terms information.
*/
export const getTermsInfo = ( terms ) => {
const mapping = terms?.reduce(
export const getTermsInfo = ( terms ) => ( {
terms,
...terms?.reduce(
( accumulator, term ) => {
const { mapById, mapByName, names } = accumulator;
mapById[ term.id ] = term;
Expand All @@ -49,13 +50,8 @@ export const getTermsInfo = ( terms ) => {
return accumulator;
},
{ mapById: {}, mapByName: {}, names: [] }
);

return {
terms,
...mapping,
};
};
),
} );

/**
* Returns a helper object that contains:
Expand Down