Skip to content

Commit

Permalink
fix: add condition to show variants tab (#5775)
Browse files Browse the repository at this point in the history
Adds a conditional check so we don't display this tab for strategies
that don't support it.
  • Loading branch information
FredrikOseberg committed Jan 5, 2024
1 parent de7f6e0 commit 04814bf
Showing 1 changed file with 14 additions and 10 deletions.
Expand Up @@ -339,6 +339,8 @@ export const NewFeatureStrategyForm = ({
return constraintCount + segmentCount;
};

const showVariants =
strategy.parameters && 'stickiness' in strategy.parameters;
return (
<>
<StyledHeaderBox>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 04814bf

Please sign in to comment.