From 88f5b62a237b3a0596801dea6a35d4a620ced891 Mon Sep 17 00:00:00 2001 From: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:06:55 -0500 Subject: [PATCH] VizTooltips: Tolerate missing annotation text (#83634) --- .../timeseries/plugins/annotations2/AnnotationTooltip2.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/timeseries/plugins/annotations2/AnnotationTooltip2.tsx b/public/app/plugins/panel/timeseries/plugins/annotations2/AnnotationTooltip2.tsx index c8c3deec319..641f0044a43 100644 --- a/public/app/plugins/panel/timeseries/plugins/annotations2/AnnotationTooltip2.tsx +++ b/public/app/plugins/panel/timeseries/plugins/annotations2/AnnotationTooltip2.tsx @@ -32,7 +32,7 @@ export const AnnotationTooltip2 = ({ annoVals, annoIdx, timeZone, onEdit }: Prop }); let time = timeFormatter(annoVals.time[annoIdx]); - let text = annoVals.text[annoIdx]; + let text = annoVals.text?.[annoIdx] ?? ''; if (annoVals.isRegion?.[annoIdx]) { time += ' - ' + timeFormatter(annoVals.timeEnd[annoIdx]); @@ -56,7 +56,7 @@ export const AnnotationTooltip2 = ({ annoVals, annoIdx, timeZone, onEdit }: Prop // alertText = alertDef.getAlertAnnotationInfo(annotation); // @TODO ?? } else if (annoVals.title?.[annoIdx]) { - text = annoVals.title[annoIdx] + '
' + (typeof text === 'string' ? text : ''); + text = annoVals.title[annoIdx] + text ? `
${text}` : ''; } return (