From 13773a78934a00fc46472e26766dbeda4506767d Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 12 Jul 2021 21:58:48 +0200 Subject: [PATCH] Revert "Update getTermsInfo() to workaround parsing issue for translatable strings (#33341)" This reverts commit daf7814d0ce7b9c1312498e598918e2ef0e7dc24. --- packages/block-library/src/query/utils.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/block-library/src/query/utils.js b/packages/block-library/src/query/utils.js index 6ff6e026e08b3..d8edac0adb145 100644 --- a/packages/block-library/src/query/utils.js +++ b/packages/block-library/src/query/utils.js @@ -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; @@ -49,13 +50,8 @@ export const getTermsInfo = ( terms ) => { return accumulator; }, { mapById: {}, mapByName: {}, names: [] } - ); - - return { - terms, - ...mapping, - }; -}; + ), +} ); /** * Returns a helper object that contains: