VizTooltips: Tolerate missing annotation text (#83634)

This commit is contained in:
Darren Janeczek
2024-02-28 17:06:55 -06:00
committed by GitHub
parent 5eb7e09351
commit 88f5b62a23
@@ -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] + '<br />' + (typeof text === 'string' ? text : '');
text = annoVals.title[annoIdx] + text ? `<br />${text}` : '';
}
return (