From 2278bf759c8861d78c9a72eae9403d044dbbdd36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Ma=C5=A1=C3=AD=C4=8Dek?= Date: Thu, 25 May 2023 11:34:24 +0200 Subject: [PATCH 1/2] Do not handle onLaneScroll after the last page was loaded --- src/controllers/Lane.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controllers/Lane.js b/src/controllers/Lane.js index 3a8303a8..0ab52321 100644 --- a/src/controllers/Lane.js +++ b/src/controllers/Lane.js @@ -19,7 +19,8 @@ class Lane extends Component { currentPage: this.props.currentPage, addCardMode: false, collapsed: false, - isDraggingOver: false + isDraggingOver: false, + lastPage: false } handleScroll = evt => { @@ -27,7 +28,7 @@ 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) { + if (elemScrollPosition < 1 && onLaneScroll && !this.state.loading && !this.state.lastPage) { const {currentPage} = this.state this.setState({loading: true}) const nextPage = currentPage + 1 @@ -38,6 +39,8 @@ class Lane extends Component { newCards: moreCards, nextPage: nextPage }) + } else { + this.setState({lastPage: true}); } this.setState({loading: false}) }) From 2996bad65c9d99c125115d9674b9422ee97cc4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Ma=C5=A1=C3=AD=C4=8Dek?= Date: Wed, 12 Jul 2023 09:54:11 +0200 Subject: [PATCH 2/2] Rename state lastPage to isPageLast --- src/controllers/Lane.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/Lane.js b/src/controllers/Lane.js index 0ab52321..be4a0f10 100644 --- a/src/controllers/Lane.js +++ b/src/controllers/Lane.js @@ -20,7 +20,7 @@ class Lane extends Component { addCardMode: false, collapsed: false, isDraggingOver: false, - lastPage: false + isPageLast: false } handleScroll = evt => { @@ -28,7 +28,7 @@ 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 && !this.state.lastPage) { + if (elemScrollPosition < 1 && onLaneScroll && !this.state.loading && !this.state.isPageLast) { const {currentPage} = this.state this.setState({loading: true}) const nextPage = currentPage + 1 @@ -40,7 +40,7 @@ class Lane extends Component { nextPage: nextPage }) } else { - this.setState({lastPage: true}); + this.setState({isPageLast: true}); } this.setState({loading: false}) })