diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-03-26 15:54:53 +0100 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-03-26 16:26:59 +0100 |
commit | 00376b43f82b1b751974e827931373595c40c0f7 (patch) | |
tree | c5d529db5499564aa794ccdcb4227fe1fd1a7ff4 /client | |
parent | fb163a24939e97756ac91361893c55ec760355fa (diff) | |
download | wekan-00376b43f82b1b751974e827931373595c40c0f7.tar.gz wekan-00376b43f82b1b751974e827931373595c40c0f7.tar.bz2 wekan-00376b43f82b1b751974e827931373595c40c0f7.zip |
list: make sure the spinner of infinite scrolling doesn't show on load
When loading a board on a high resolution screen, there is a chance there
is not enough cards displayed and the spinner is still there, spinning
forever.
Add an idle callback that checks if the spinner is still there, and while
it is there, extend the number of cards to show.
Fixes #2250
Diffstat (limited to 'client')
-rw-r--r-- | client/components/lists/listBody.js | 13 |
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]; }, |