Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update getTermsInfo() to workaround parsing issue for translatable st…
…rings (#33341)
  • Loading branch information
ocean90 authored and youknowriad committed Jul 12, 2021
commit c0616d7763b1177642a8b521ecc60b1a2ebef798
14 changes: 9 additions & 5 deletions packages/block-library/src/query/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ 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 ) => ( {
terms,
...terms?.reduce(
export const getTermsInfo = ( terms ) => {
const mapping = terms?.reduce(
( accumulator, term ) => {
const { mapById, mapByName, names } = accumulator;
mapById[ term.id ] = term;
Expand All @@ -50,8 +49,13 @@ export const getTermsInfo = ( terms ) => ( {
return accumulator;
},
{ mapById: {}, mapByName: {}, names: [] }
),
} );
);

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

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