From 606012fff898034a6a78d6b249a9285da6298a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Ma=C5=A1=C3=AD=C4=8Dek?= Date: Thu, 16 Nov 2023 15:58:32 +0100 Subject: [PATCH] Fix infinite scrolling In come cases `elemScrollPosition` is never smaller than 1 and infinite scrolling ended too soon. Then we use some bigger value to compare. --- src/controllers/Lane.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/Lane.js b/src/controllers/Lane.js index 3a8303a8..d96214e8 100644 --- a/src/controllers/Lane.js +++ b/src/controllers/Lane.js @@ -27,7 +27,8 @@ class Lane extends Component { const elemScrollPosition = node.scrollHeight - node.scrollTop - node.clientHeight const {onLaneScroll} = this.props // In some browsers and/or screen sizes a decimal rest value between 0 and 1 exists, so it should be checked on < 1 instead of < 0 - if (elemScrollPosition < 1 && onLaneScroll && !this.state.loading) { + // However, in come cases `elemScrollPosition` is never smaller than 1 and infinite scrolling ended too soon. Then we use some bigger value to compare + if (elemScrollPosition < 15 && onLaneScroll && !this.state.loading) { const {currentPage} = this.state this.setState({loading: true}) const nextPage = currentPage + 1