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.
This commit is contained in:
infiinte-persistence 2020-06-15 12:21:51 +02:00 committed by Sean Yesmunt
parent c957b159b1
commit 522c6ddcd6

View file

@ -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();