1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: add condition to show variants tab (#5775)

Adds a conditional check so we don't display this tab for strategies
that don't support it.
This commit is contained in:
Fredrik Strand Oseberg 2024-01-05 11:05:58 +01:00 committed by GitHub
parent de7f6e035e
commit 04814bfc63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,6 +339,8 @@ export const NewFeatureStrategyForm = ({
return constraintCount + segmentCount; return constraintCount + segmentCount;
}; };
const showVariants =
strategy.parameters && 'stickiness' in strategy.parameters;
return ( return (
<> <>
<StyledHeaderBox> <StyledHeaderBox>
@ -381,16 +383,18 @@ export const NewFeatureStrategyForm = ({
</Typography> </Typography>
} }
/> />
<Tab {showVariants && (
label={ <Tab
<Typography> label={
Variants <Typography>
<StyledBadge> Variants
{strategy.variants?.length} <StyledBadge>
</StyledBadge> {strategy.variants?.length || 0}
</Typography> </StyledBadge>
} </Typography>
/> }
/>
)}
</StyledTabs> </StyledTabs>
<StyledForm onSubmit={onSubmitWithValidation}> <StyledForm onSubmit={onSubmitWithValidation}>
<ConditionallyRender <ConditionallyRender