From 4f9d3d8be56f32837cab9de0cce523c285cc6f9a Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 26 Apr 2021 18:48:27 +0200 Subject: [PATCH] List infinite scroll now always works - before sometimes list scrolling stopped even the spinner was visible and scrolling was at the end of the list --- client/components/lists/listBody.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 65eff9ed5..b34d792a2 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -770,16 +770,21 @@ BlazeComponent.extendComponent({ }, spinnerInView() { - const parentViewHeight = this.container.clientHeight; - const bottomViewPosition = this.container.scrollTop + parentViewHeight; - - const threshold = this.spinner.offsetTop; - // spinner deleted if (!this.spinner.offsetTop) { return false; } - return bottomViewPosition > threshold; + const parentViewHeight = this.container.clientHeight; + const bottomViewPosition = this.container.scrollTop + parentViewHeight; + + let spinnerOffsetTop = this.spinner.offsetTop; + + const addCard = $(this.container).find("a.open-minicard-composer").first()[0]; + if (addCard !== undefined) { + spinnerOffsetTop -= addCard.clientHeight; + } + + return bottomViewPosition > spinnerOffsetTop; }, }).register('spinnerList');