Fix potential display of "0" on rule details tab

When looking at the details tab of an alert rule, the last evaluation could potentially display as `0` due to falsy checks on React rendering
This commit is contained in:
Tom Ratcliffe
2024-03-25 18:27:48 +00:00
committed by Tom Ratcliffe
parent a94c3d63cc
commit 9a416b8241

View File

@@ -79,12 +79,12 @@ const Details = ({ rule }: DetailsProps) => {
{hasEvaluationDuration && ( {hasEvaluationDuration && (
<> <>
Last evaluation Last evaluation
{evaluationTimestamp && evaluationDuration && ( {evaluationTimestamp && evaluationDuration ? (
<span> <span>
<Text color="primary">{formatDistanceToNowStrict(new Date(evaluationTimestamp))} ago</Text>, took{' '} <Text color="primary">{formatDistanceToNowStrict(new Date(evaluationTimestamp))} ago</Text>, took{' '}
<Text color="primary">{evaluationDuration}ms</Text> <Text color="primary">{evaluationDuration}ms</Text>
</span> </span>
)} ) : null}
</> </>
)} )}
</MetaText> </MetaText>