mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 08:18:10 -05:00
TooltipPlugin: Prevent Tooltip render if field is undefined (#36260)
* Tooltip Plugin: Prevent tooltip render if focusedSeriesIdx is out of range * TooltipPlugin: Also prevent render in multi case * TooltipPlugin: Return null if field is undefined
This commit is contained in:
@@ -135,6 +135,10 @@ export const TooltipPlugin: React.FC<TooltipPluginProps> = ({
|
||||
if (mode === TooltipDisplayMode.Single && focusedSeriesIdx !== null) {
|
||||
const field = otherProps.data.fields[focusedSeriesIdx];
|
||||
|
||||
if (!field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const fieldFmt = field.display || getDisplayProcessor({ field, timeZone, theme });
|
||||
const display = fieldFmt(field.values.get(focusedPointIdx));
|
||||
|
||||
@@ -160,6 +164,7 @@ export const TooltipPlugin: React.FC<TooltipPluginProps> = ({
|
||||
const frame = otherProps.data;
|
||||
const field = frame.fields[i];
|
||||
if (
|
||||
!field ||
|
||||
field === xField ||
|
||||
field.type === FieldType.time ||
|
||||
field.type !== FieldType.number ||
|
||||
|
||||
Reference in New Issue
Block a user