Skip to content

Commit

Permalink
Filter unit only values when checking values defined
Browse files Browse the repository at this point in the history
This prevents a false positive when the box control checks whether it has any unlinked values defined.
  • Loading branch information
aaronrobertshaw committed May 13, 2021
1 parent 8195c17 commit 90a8fc0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/components/src/box-control/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export function isValuesMixed( values = {} ) {
export function isValuesDefined( values ) {
return (
values !== undefined &&
! isEmpty( Object.values( values ).filter( Boolean ) )
! isEmpty(
Object.values( values ).filter(
// Switching units when input is empty causes values only
// containing units. This gives false positive on mixed values
// unless filtered.
( value ) => !! value && /\d/.test( value )
)
)
);
}

0 comments on commit 90a8fc0

Please sign in to comment.