Skip to content

Commit 7dbd28e

Browse files
authored
feat: compare empty string display (#7498)
1 parent 70f25fa commit 7dbd28e

6 files changed

Lines changed: 7 additions & 19 deletions

File tree

frontend/web/components/CompareIdentities.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ const CompareIdentities: FC<CompareIdentitiesType> = ({
339339
>
340340
{featureStateLeft && (
341341
<FeatureValue
342-
includeEmpty={false}
343342
value={featureStateLeft?.feature_state_value}
344343
/>
345344
)}
@@ -358,7 +357,6 @@ const CompareIdentities: FC<CompareIdentitiesType> = ({
358357
>
359358
{featureStateRight && (
360359
<FeatureValue
361-
includeEmpty={false}
362360
value={featureStateRight?.feature_state_value}
363361
/>
364362
)}

frontend/web/components/IdentityTraits.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ const IdentityTraits: FC<IdentityTraitsType> = ({
170170
</Flex>
171171
<Flex className='table-column'>
172172
<FeatureValue
173-
includeEmpty
174173
data-test={`user-trait-value-${i}`}
175174
value={trait_value}
176175
/>

frontend/web/components/diff/DiffString.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const sanitiseDiffString = (value: FlagsmithValue) => {
1414
if (value === undefined || value === null) {
1515
return ''
1616
}
17+
if (value === '') {
18+
return '""'
19+
}
1720
return `${value}`
1821
}
1922
const DiffString: FC<DiffType> = ({

frontend/web/components/feature-override/MultivariateOverrideDescription.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ const Multivariate: FC<MultivariateType> = ({ controlValue }) => {
1212
<span className='flex-row'>
1313
This feature is being overridden by a % variation in the environment,
1414
the control value of this feature is{' '}
15-
<FeatureValue
16-
className='ml-1 chip--xs'
17-
includeEmpty
18-
value={controlValue}
19-
/>
15+
<FeatureValue className='ml-1 chip--xs' value={controlValue} />
2016
</span>
2117
</div>
2218
)

frontend/web/components/feature-override/SegmentOverrideDescription.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ const SegmentOverrideDescription: FC<SegmentOverrideDescriptionType> = ({
5656
{`This feature is being overridden by ${
5757
level === 'segment' ? 'this segment' : 'a segment'
5858
} and would normally be`}
59-
<FeatureValue
60-
className='ml-1 chip--xs'
61-
includeEmpty
62-
value={`${controlValue}`}
63-
/>
59+
<FeatureValue className='ml-1 chip--xs' value={`${controlValue}`} />
6460
{level === 'identity' ? ' for this user' : ''}
6561
</span>
6662
)}

frontend/web/components/feature-summary/FeatureValue.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import classNames from 'classnames'
77

88
type FeatureValueType = {
99
value: FlagsmithValue
10-
includeEmpty?: boolean // whether to show empty values
1110
className?: string
1211
onClick?: () => void
1312
'data-test'?: string
@@ -18,9 +17,6 @@ const FeatureValue: FC<FeatureValueType> = (props) => {
1817
return null
1918
}
2019
const type = typeof props.value
21-
if (type === 'string' && props.value === '' && !props.includeEmpty) {
22-
return null
23-
}
2420
const isCompact = getViewMode() === 'compact'
2521
return (
2622
<div
@@ -31,7 +27,7 @@ const FeatureValue: FC<FeatureValueType> = (props) => {
3127
data-test={props['data-test']}
3228
style={{ maxWidth: 'fit-content' }}
3329
>
34-
{type == 'string' && <span className='quot'>"</span>}
30+
{type === 'string' && <span className='quot'>"</span>}
3531
<span
3632
className='feature-value'
3733
style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}
@@ -41,7 +37,7 @@ const FeatureValue: FC<FeatureValueType> = (props) => {
4137
isCompact ? 24 : 20,
4238
)}
4339
</span>
44-
{type == 'string' && <span className='quot'>"</span>}
40+
{type === 'string' && <span className='quot'>"</span>}
4541
</div>
4642
)
4743
}

0 commit comments

Comments
 (0)