Skip to content

Commit

Permalink
Don't check the threshold value in the preview
Browse files Browse the repository at this point in the history
According to the types, if a threshold is present it always has a
`threshold.value` so there's no need to check. This also prevents
treating a value of `0` as `false`.
  • Loading branch information
Alejandro Fernández Gómez committed Sep 3, 2021
1 parent 7141ae7 commit 15e3fd0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const CriterionPreviewChart: React.FC<ChartProps> = ({
}}
color={!isGrouped ? colorTransformer(Color.color0) : undefined}
/>
{showThreshold && threshold && threshold.value ? (
{showThreshold && threshold ? (
<LineAnnotation
id={`threshold-line`}
domainType={AnnotationDomainType.YDomain}
Expand All @@ -260,7 +260,7 @@ const CriterionPreviewChart: React.FC<ChartProps> = ({
}}
/>
) : null}
{showThreshold && threshold && threshold.value && isBelow ? (
{showThreshold && threshold && isBelow ? (
<RectAnnotation
id="below-threshold"
style={{
Expand All @@ -279,7 +279,7 @@ const CriterionPreviewChart: React.FC<ChartProps> = ({
]}
/>
) : null}
{showThreshold && threshold && threshold.value && isAbove ? (
{showThreshold && threshold && isAbove ? (
<RectAnnotation
id="above-threshold"
style={{
Expand Down

0 comments on commit 15e3fd0

Please sign in to comment.