mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Field: Fix perf regression in getUniqueFieldName() (#81323)
Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
parent
ad1c4b726b
commit
0530021396
@ -1,5 +1,3 @@
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
import { DataFrame, Field, TIME_SERIES_VALUE_FIELD_NAME, FieldType, TIME_SERIES_TIME_FIELD_NAME } from '../types';
|
||||
import { formatLabels } from '../utils/labels';
|
||||
|
||||
@ -167,7 +165,7 @@ export function getUniqueFieldName(field: Field, frame?: DataFrame) {
|
||||
for (let i = 0; i < frame.fields.length; i++) {
|
||||
const otherField = frame.fields[i];
|
||||
|
||||
if (isEqual(field, otherField)) {
|
||||
if (field === otherField) {
|
||||
foundSelf = true;
|
||||
|
||||
if (dupeCount > 0) {
|
||||
|
@ -41,9 +41,8 @@ export function getDisplayValuesAndLinks(
|
||||
sortOrder?: SortOrder,
|
||||
mode?: TooltipDisplayMode | null
|
||||
) {
|
||||
const fields = data.fields.map((f, idx) => {
|
||||
return { ...f, hovered: idx === columnIndex };
|
||||
});
|
||||
const fields = data.fields;
|
||||
const hoveredField = columnIndex != null ? fields[columnIndex] : null;
|
||||
|
||||
const visibleFields = fields.filter((f) => !Boolean(f.config.custom?.hideFrom?.tooltip));
|
||||
const traceIDField = visibleFields.find((field) => field.name === 'traceID') || fields[0];
|
||||
@ -63,7 +62,7 @@ export function getDisplayValuesAndLinks(
|
||||
const linkLookup = new Set<string>();
|
||||
|
||||
for (const field of orderedVisibleFields) {
|
||||
if (mode === TooltipDisplayMode.Single && columnIndex != null && !field.hovered) {
|
||||
if (mode === TooltipDisplayMode.Single && field !== hoveredField) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -80,14 +79,11 @@ export function getDisplayValuesAndLinks(
|
||||
});
|
||||
}
|
||||
|
||||
// Sanitize field by removing hovered property to fix unique display name issue
|
||||
const { hovered, ...sanitizedField } = field;
|
||||
|
||||
displayValues.push({
|
||||
name: getFieldDisplayName(sanitizedField, data),
|
||||
name: getFieldDisplayName(field, data),
|
||||
value,
|
||||
valueString: formattedValueToString(fieldDisplay),
|
||||
highlight: field.hovered,
|
||||
highlight: field === hoveredField,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user