diff --git a/packages/editor/src/hooks/custom-sources-backwards-compatibility.js b/packages/editor/src/hooks/custom-sources-backwards-compatibility.js index bf73a3ade79353..b0b1bf96e9d295 100644 --- a/packages/editor/src/hooks/custom-sources-backwards-compatibility.js +++ b/packages/editor/src/hooks/custom-sources-backwards-compatibility.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { mapValues, isEmpty } from 'lodash'; +import { isEmpty } from 'lodash'; /** * WordPress dependencies @@ -57,9 +57,13 @@ const createWithMetaAttributeSource = ( metaAttributes ) => const mergedAttributes = useMemo( () => ( { ...attributes, - ...mapValues( - metaAttributes, - ( metaKey ) => meta[ metaKey ] + ...Object.fromEntries( + Object.entries( metaAttributes ).map( + ( [ attributeKey, metaKey ] ) => [ + attributeKey, + meta[ metaKey ], + ] + ) ), } ), [ attributes, meta ] @@ -106,13 +110,10 @@ const createWithMetaAttributeSource = ( metaAttributes ) => */ function shimAttributeSource( settings ) { /** @type {WPMetaAttributeMapping} */ - const metaAttributes = mapValues( - Object.fromEntries( - Object.entries( settings.attributes ?? {} ).filter( - ( [ , { source } ] ) => source === 'meta' - ) - ), - 'meta' + const metaAttributes = Object.fromEntries( + Object.entries( settings.attributes ?? {} ) + .filter( ( [ , { source } ] ) => source === 'meta' ) + .map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] ) ); if ( ! isEmpty( metaAttributes ) ) { settings.edit = createWithMetaAttributeSource( metaAttributes )(