diff --git a/examples/package-lock.json b/examples/package-lock.json index ab89107..d1d5def 100644 --- a/examples/package-lock.json +++ b/examples/package-lock.json @@ -17,7 +17,7 @@ } }, "..": { - "version": "2.1.0", + "version": "2.4.2", "license": "MIT", "dependencies": { "@react-aria/overlays": "3.14.0", @@ -84,8 +84,7 @@ "typescript": "^4.9.5" }, "peerDependencies": { - "react": "^16.13.1", - "react-dom": "^16.13.1" + "react": "^16.13.1" } }, "../node_modules/classnames": {}, diff --git a/src/Components/NetworkTable/NetworkTableBody.jsx b/src/Components/NetworkTable/NetworkTableBody.jsx index d827d4c..3bf6e13 100644 --- a/src/Components/NetworkTable/NetworkTableBody.jsx +++ b/src/Components/NetworkTable/NetworkTableBody.jsx @@ -50,22 +50,24 @@ const NetworkTableBody = ({ height }) => { const totalNetworkTime = state.get('totalNetworkTime'); const selectedReqIndex = state.get('selectedReqIndex'); - const ref = useRef(null); - const { elementDims } = useResizeObserver(ref?.current?._outerRef || ref?.current); + const listRef = useRef(null); + const { elementDims } = useResizeObserver(listRef); - useEffect(() => actions.setTableHeaderWidth(elementDims.width), [elementDims]); + useEffect(() => { + actions.setTableHeaderWidth(elementDims.width); + }, [elementDims]); useEffect(() => { - if (enableAutoScroll && ref?.current?._outerRef) { - const outerRef = ref?.current?._outerRef; + if (enableAutoScroll && listRef?.current?._outerRef) { + const outerRef = listRef?.current?._outerRef; const needToScroll = outerRef.scrollTop + outerRef.offsetHeight + (numberOfNewEntries * TABLE_ENTRY_HEIGHT) >= outerRef.scrollHeight; if (needToScroll) { - ref.current._outerRef.scrollTop = outerRef.scrollHeight; + listRef.current._outerRef.scrollTop = outerRef.scrollHeight; } } - }, [data, ref]); + }, [data, listRef]); const handleReqSelect = (payload) => { if (selectedReqIndex === payload.index) { @@ -80,7 +82,7 @@ const NetworkTableBody = ({ height }) => { if (actualData.size === 0) { return (