From 522c6ddcd6acf64021d8cdcfb661aad83890ac57 Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Mon, 15 Jun 2020 12:21:51 +0200 Subject: [PATCH] Inf-scroll: Fix "am I at bottom" logic. If you are at the bottom and you hit the UP_ARROW key one time, the logic still thinks we are at the bottom, despite the component has clearly moved. Similar to the issue noted in the previous commit, this causes the page to increment incorrectly. My wild guess is that the previous logic depends on the css height, so it might got broken due to css changes. Hopefully the new calculation is more robust and works for all cases. --- ui/component/claimList/view.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/component/claimList/view.jsx b/ui/component/claimList/view.jsx index a1d37a11f..ca056939b 100644 --- a/ui/component/claimList/view.jsx +++ b/ui/component/claimList/view.jsx @@ -81,7 +81,8 @@ export default function ClaimList(props: Props) { const mainElWrapper = document.querySelector(`.${MAIN_WRAPPER_CLASS}`); if (mainElWrapper && !loading && urisLength >= pageSize) { - const contentWrapperAtBottomOfPage = window.scrollY + window.innerHeight >= mainElWrapper.offsetHeight; + const contentWrapperAtBottomOfPage = + mainElWrapper.getBoundingClientRect().bottom - 0.5 <= window.innerHeight; if (contentWrapperAtBottomOfPage) { onScrollBottom();