11//TODO refactor bulk action and row action to single function to decrease repeatability
2- import React , { useEffect , useMemo , useState , useCallback , useRef } from "react"
2+ import React , { useEffect , useState , useCallback , useRef } from "react"
33import {
44 getCoreRowModel ,
55 getFilteredRowModel ,
@@ -14,6 +14,7 @@ import makePagination from "./features/pagination"
1414import useBulkActions from "./features/useBulkActions"
1515import ColumnPinning from "./features/columnPinning"
1616import GlobalControls from "./features/globalControls"
17+ import useRowHover from "./features/useRowHover"
1718
1819import MainTable from "./features/mainTable"
1920
@@ -58,6 +59,8 @@ const NetdataTable = ({
5859 virtualizeOptions = { } ,
5960 ...rest
6061} ) => {
62+ const [ hoveredRow , setHoveredRow ] = useRowHover ( onHoverRow )
63+
6164 const [ columnVisibility , setColumnVisibility ] = useState ( defaultColumnVisibility )
6265
6366 useEffect ( ( ) => {
@@ -192,7 +195,8 @@ const NetdataTable = ({
192195 headers = { table . getLeftFlatHeaders ( ) }
193196 testPrefix = { testPrefix }
194197 dataGa = { dataGa }
195- onHoverRow = { onHoverRow }
198+ onHoverRow = { setHoveredRow }
199+ hoveredRow = { hoveredRow }
196200 scrollParentRef = { scrollParentRef }
197201 virtualizeOptions = { virtualizeOptions }
198202 />
@@ -209,7 +213,8 @@ const NetdataTable = ({
209213 dataGa = { dataGa }
210214 tableRef = { tableRef }
211215 testPrefix = { testPrefix }
212- onHoverRow = { onHoverRow }
216+ onHoverRow = { setHoveredRow }
217+ hoveredRow = { hoveredRow }
213218 virtualizeOptions = { virtualizeOptions }
214219 { ...rest }
215220 />
0 commit comments