Skip to content

Commit

Permalink
SpacingSizesControl: Fix problem with the slider position being reset…
Browse files Browse the repository at this point in the history
… when saving global styles (#50956)
  • Loading branch information
t-hamano authored May 26, 2023
1 parent 971ed6c commit 429d52e
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,19 @@ export default function DimensionsPanel( {
// in global styles but not in block inspector.
includeLayoutControls = false,
} ) {
const decodeValue = ( rawValue ) =>
getValueFromVariable( { settings }, '', rawValue );
const decodeValue = ( rawValue ) => {
if ( typeof rawValue === 'object' ) {
return Object.keys( rawValue ).reduce( ( acc, key ) => {
acc[ key ] = getValueFromVariable(
{ settings },
'',
rawValue[ key ]
);
return acc;
}, {} );
}
return getValueFromVariable( { settings }, '', rawValue );
};

const showSpacingPresetsControl = useHasSpacingPresets( settings );
const units = useCustomUnits( {
Expand Down

1 comment on commit 429d52e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 429d52e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5089672800
📝 Reported issues:

Please sign in to comment.