@@ -50,22 +50,24 @@ const NetworkTableBody = ({ height }) => {
50
50
const totalNetworkTime = state . get ( 'totalNetworkTime' ) ;
51
51
const selectedReqIndex = state . get ( 'selectedReqIndex' ) ;
52
52
53
- const ref = useRef ( null ) ;
54
- const { elementDims } = useResizeObserver ( ref ?. current ?. _outerRef || ref ?. current ) ;
53
+ const listRef = useRef ( null ) ;
54
+ const { elementDims } = useResizeObserver ( listRef ) ;
55
55
56
- useEffect ( ( ) => actions . setTableHeaderWidth ( elementDims . width ) , [ elementDims ] ) ;
56
+ useEffect ( ( ) => {
57
+ actions . setTableHeaderWidth ( elementDims . width ) ;
58
+ } , [ elementDims ] ) ;
57
59
58
60
useEffect ( ( ) => {
59
- if ( enableAutoScroll && ref ?. current ?. _outerRef ) {
60
- const outerRef = ref ?. current ?. _outerRef ;
61
+ if ( enableAutoScroll && listRef ?. current ?. _outerRef ) {
62
+ const outerRef = listRef ?. current ?. _outerRef ;
61
63
const needToScroll = outerRef . scrollTop +
62
64
outerRef . offsetHeight +
63
65
( numberOfNewEntries * TABLE_ENTRY_HEIGHT ) >= outerRef . scrollHeight ;
64
66
if ( needToScroll ) {
65
- ref . current . _outerRef . scrollTop = outerRef . scrollHeight ;
67
+ listRef . current . _outerRef . scrollTop = outerRef . scrollHeight ;
66
68
}
67
69
}
68
- } , [ data , ref ] ) ;
70
+ } , [ data , listRef ] ) ;
69
71
70
72
const handleReqSelect = ( payload ) => {
71
73
if ( selectedReqIndex === payload . index ) {
@@ -80,7 +82,7 @@ const NetworkTableBody = ({ height }) => {
80
82
if ( actualData . size === 0 ) {
81
83
return (
82
84
< div
83
- ref = { ref }
85
+ ref = { listRef }
84
86
className = { Styles [ 'no-data' ] }
85
87
>
86
88
< IconNetworkRequest className = { Styles [ 'network-icon' ] } />
@@ -98,7 +100,7 @@ const NetworkTableBody = ({ height }) => {
98
100
return (
99
101
< >
100
102
< FixedSizeList
101
- ref = { ref }
103
+ ref = { listRef }
102
104
className = { Styles [ 'network-table-body' ] }
103
105
height = { height }
104
106
itemCount = { data . size }
0 commit comments