Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock

.vscode
14 changes: 7 additions & 7 deletions src/Components/NetworkTable/NetworkTableBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ const NetworkTableBody = ({ height }) => {
}, [elementDims]);

useEffect(() => {
if (enableAutoScroll && listRef?.current?._outerRef) {
const outerRef = listRef?.current?._outerRef;
const needToScroll = outerRef.scrollTop +
outerRef.offsetHeight +
(numberOfNewEntries * TABLE_ENTRY_HEIGHT) >= outerRef.scrollHeight;
if (enableAutoScroll && listRef?.current) {
const { offsetHeight, scrollHeight } = listRef.current;
let { scrollTop } = listRef.current;
const needToScroll = scrollTop + offsetHeight +
(numberOfNewEntries * TABLE_ENTRY_HEIGHT) >= scrollHeight;
if (needToScroll) {
listRef.current._outerRef.scrollTop = outerRef.scrollHeight;
scrollTop = scrollHeight;
}
}
}, [data, listRef]);
Expand Down Expand Up @@ -100,7 +100,6 @@ const NetworkTableBody = ({ height }) => {
return (
<>
<FixedSizeList
ref={listRef}
className={Styles['network-table-body']}
height={height}
itemCount={data.size}
Expand All @@ -111,6 +110,7 @@ const NetworkTableBody = ({ height }) => {
selectedReqIndex,
}}
itemSize={TABLE_ENTRY_HEIGHT}
outerRef={listRef}
>
{virtualizedTableRow}
</FixedSizeList>
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useResizeObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useResizeObserver = (elementRef) => {
});

useEffect(() => {
const ref = elementRef?.current?._outerRef || elementRef?.current;
const ref = elementRef?.current;
const onResize = debounce(() => {
if (ref) {
setElementDims({
Expand All @@ -40,7 +40,7 @@ export const useResizeObserver = (elementRef) => {
resizeObserver.unobserve(ref);
}
};
}, [elementRef?.current]);
}, [elementRef]);

return { elementDims };
};