Skip to content

Commit d0b97b1

Browse files
authored
fix flash issue on table element click (#469)
1 parent db4d4f5 commit d0b97b1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/components/directory-content-table.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
AgGridEvent,
1919
GetRowIdParams,
2020
} from 'ag-grid-community';
21-
import { RefObject } from 'react';
21+
import { RefObject, useCallback } from 'react';
2222

2323
interface DirectoryContentTableProps
2424
extends Pick<
@@ -69,12 +69,15 @@ export const DirectoryContentTable = ({
6969
onGridReady,
7070
colDef,
7171
}: DirectoryContentTableProps) => {
72-
const getCustomRowStyle = (cellData: RowClassParams<ElementAttributes>) => {
73-
return {
74-
...getClickableRowStyle(cellData),
75-
...getRowStyle?.(cellData),
76-
};
77-
};
72+
const getCustomRowStyle = useCallback(
73+
(cellData: RowClassParams<ElementAttributes>) => {
74+
return {
75+
...getClickableRowStyle(cellData),
76+
...getRowStyle?.(cellData),
77+
};
78+
},
79+
[getRowStyle]
80+
);
7881

7982
return (
8083
<CustomAGGrid

0 commit comments

Comments
 (0)