mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06: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:
parent
2a4191a2ee
commit
96a3cc3cd8
@ -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 ||
|
||||
|
Loading…
Reference in New Issue
Block a user