From 9a416b82413c9837119d7d05449be66933fa26d0 Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Mon, 25 Mar 2024 18:27:48 +0000 Subject: [PATCH] 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 --- .../alerting/unified/components/rule-viewer/tabs/Details.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-viewer/tabs/Details.tsx b/public/app/features/alerting/unified/components/rule-viewer/tabs/Details.tsx index 6ff99b02903..a23aada798f 100644 --- a/public/app/features/alerting/unified/components/rule-viewer/tabs/Details.tsx +++ b/public/app/features/alerting/unified/components/rule-viewer/tabs/Details.tsx @@ -79,12 +79,12 @@ const Details = ({ rule }: DetailsProps) => { {hasEvaluationDuration && ( <> Last evaluation - {evaluationTimestamp && evaluationDuration && ( + {evaluationTimestamp && evaluationDuration ? ( {formatDistanceToNowStrict(new Date(evaluationTimestamp))} ago, took{' '} {evaluationDuration}ms - )} + ) : null} )}