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