Skip to content

Commit

Permalink
Spacing theme.json - check that the first item in the units array is …
Browse files Browse the repository at this point in the history
…defined before trying to assign its value (#56306)
  • Loading branch information
glendaviesnz authored Nov 21, 2023
1 parent 68b0d5b commit aa91684
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function SpacingInputControl( {
useMemo(
() => parseQuantityAndUnitFromRawValue( currentValue ),
[ currentValue ]
)[ 1 ] || units[ 0 ].value;
)[ 1 ] || units[ 0 ]?.value;

const setInitialValue = () => {
if ( value === undefined ) {
Expand Down
3 changes: 2 additions & 1 deletion schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@
"items": {
"type": "string"
},
"default": [ "px", "em", "rem", "vh", "vw", "%" ]
"default": [ "px", "em", "rem", "vh", "vw", "%" ],
"minItems": 1
},
"customSpacingSize": {
"description": "Allow users to set custom space sizes.",
Expand Down

0 comments on commit aa91684

Please sign in to comment.