Fix expand hover action in data grid (#108616)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Angela Chuang 2021-08-16 11:51:49 +01:00 committed by GitHub
parent c2d5d1b6c2
commit fc3b3cc2bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -507,15 +507,19 @@ export const BodyComponent = React.memo<StatefulBodyProps>(
[browserFields, columnHeaders, data, defaultCellActions]
);
const renderTGridCellValue: (
x: EuiDataGridCellValueElementProps
) => React.ReactNode = useCallback(
({ columnId, rowIndex, setCellProps }) => {
const renderTGridCellValue = useMemo(() => {
const Cell: React.FC<EuiDataGridCellValueElementProps> = ({
columnId,
rowIndex,
setCellProps,
}): React.ReactElement | null => {
const rowData = rowIndex < data.length ? data[rowIndex].data : null;
const header = columnHeaders.find((h) => h.id === columnId);
const eventId = rowIndex < data.length ? data[rowIndex]._id : null;
addBuildingBlockStyle(data[rowIndex].ecs, theme, setCellProps);
useEffect(() => {
addBuildingBlockStyle(data[rowIndex].ecs, theme, setCellProps);
}, [rowIndex, setCellProps]);
if (rowData == null || header == null || eventId == null) {
return null;
@ -537,10 +541,10 @@ export const BodyComponent = React.memo<StatefulBodyProps>(
ecsData: data[rowIndex].ecs,
browserFields,
rowRenderers,
});
},
[columnHeaders, data, id, renderCellValue, tabType, theme, browserFields, rowRenderers]
);
}) as React.ReactElement;
};
return Cell;
}, [columnHeaders, data, id, renderCellValue, tabType, theme, browserFields, rowRenderers]);
return (
<EuiDataGrid