diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx index 9ee61f96d4e..e9fe97548d6 100644 --- a/packages/desktop-client/src/components/ManageRules.tsx +++ b/packages/desktop-client/src/components/ManageRules.tsx @@ -284,7 +284,6 @@ function ManageRulesContent({ void; style?: CSSProperties; onHoverLeave?: () => void; @@ -12,32 +11,27 @@ type SimpleTableProps = { }; export default function SimpleTable({ - data, loadMore, style, onHoverLeave, children, }: SimpleTableProps) { const contentRef = useRef(); - const contentHeight = useRef(); const scrollRef = useRef(); - function onScroll(e) { - if (contentHeight.current != null) { - if (loadMore && e.target.scrollTop > contentHeight.current - 750) { - loadMore(); - } + function onScroll(e: UIEvent) { + if ( + loadMore && + Math.abs( + e.currentTarget.scrollHeight - + e.currentTarget.clientHeight - + e.currentTarget.scrollTop, + ) < 1 + ) { + loadMore(); } } - useEffect(() => { - if (contentRef.current) { - contentHeight.current = contentRef.current.getBoundingClientRect().height; - } else { - contentHeight.current = null; - } - }, [contentRef.current, data]); - return (