Browse Source

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
Martin Filser 4 years ago
parent
commit
4f9d3d8be5
1 changed files with 10 additions and 5 deletions
  1. 10 5
      client/components/lists/listBody.js

+ 10 - 5
client/components/lists/listBody.js

@@ -770,16 +770,21 @@ BlazeComponent.extendComponent({
   },
   },
 
 
   spinnerInView() {
   spinnerInView() {
+    // spinner deleted
+    if (!this.spinner.offsetTop) {
+      return false;
+    }
+
     const parentViewHeight = this.container.clientHeight;
     const parentViewHeight = this.container.clientHeight;
     const bottomViewPosition = this.container.scrollTop + parentViewHeight;
     const bottomViewPosition = this.container.scrollTop + parentViewHeight;
 
 
-    const threshold = this.spinner.offsetTop;
+    let spinnerOffsetTop = this.spinner.offsetTop;
 
 
-    // spinner deleted
-    if (!this.spinner.offsetTop) {
-      return false;
+    const addCard = $(this.container).find("a.open-minicard-composer").first()[0];
+    if (addCard !== undefined) {
+      spinnerOffsetTop -= addCard.clientHeight;
     }
     }
 
 
-    return bottomViewPosition > threshold;
+    return bottomViewPosition > spinnerOffsetTop;
   },
   },
 }).register('spinnerList');
 }).register('spinnerList');