Table: RowsList passing incorrect index to onRowHover (#97599)

* chore: fix table returning the wrong index to onRowHover
pull/97687/head
Galen Kistler 5 months ago committed by GitHub
parent b1f1144807
commit 645776afc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      packages/grafana-ui/src/components/Table/RowsList.tsx

@ -124,12 +124,16 @@ export const RowsList = (props: RowsListProps) => {
const onRowHover = useCallback(
(idx: number, frame: DataFrame) => {
if (!panelContext || !enableSharedCrosshair || !hasTimeField(frame)) {
if (!panelContext || !enableSharedCrosshair) {
return;
}
const timeField: Field = frame!.fields.find((f) => f.type === FieldType.time)!;
if (!timeField) {
return;
}
panelContext.eventBus.publish(
new DataHoverEvent({
point: {
@ -311,7 +315,7 @@ export const RowsList = (props: RowsListProps) => {
key={key}
{...rowProps}
className={cx(tableStyles.row, expandedRowStyle)}
onMouseEnter={() => onRowHover(index, data)}
onMouseEnter={() => onRowHover(row.index, data)}
onMouseLeave={onRowLeave}
>
{/*add the nested data to the DOM first to prevent a 1px border CSS issue on the last cell of the row*/}

Loading…
Cancel
Save