summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/lists/listBody.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 006f8f0d..d6a62cc9 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -5,6 +5,7 @@ BlazeComponent.extendComponent({
onCreated() {
// for infinite scrolling
this.cardlimit = new ReactiveVar(InfiniteScrollIter);
+ this.spinnerShown = false;
},
onRendered() {
@@ -19,9 +20,8 @@ BlazeComponent.extendComponent({
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
- if (entry.isIntersecting) {
- this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
- }
+ this.spinnerShown = entry.isIntersecting;
+ this.updateList();
});
}, options);
@@ -29,6 +29,13 @@ BlazeComponent.extendComponent({
}
},
+ updateList() {
+ if (this.spinnerShown) {
+ this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
+ window.requestIdleCallback(() => this.updateList());
+ }
+ },
+
mixins() {
return [Mixins.PerfectScrollbar];
},