summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-02-22 16:32:54 +0200
committerLauri Ojansivu <x@xet7.org>2020-02-22 16:32:54 +0200
commit2b9540ce02de604bf84ea082f2dcb1d01673708c (patch)
tree68db66cad95d75e93c42df687c2025251bb0a21f /client
parent906c25d5e8fa77988bb7069f2d826e139e07cca4 (diff)
downloadwekan-2b9540ce02de604bf84ea082f2dcb1d01673708c.tar.gz
wekan-2b9540ce02de604bf84ea082f2dcb1d01673708c.tar.bz2
wekan-2b9540ce02de604bf84ea082f2dcb1d01673708c.zip
Try to fix afterwards loading of cards by adding
fallback when requestIdleCallback is not available. Thanks to xet7 ! Closes #2878, closes #2250
Diffstat (limited to 'client')
-rw-r--r--client/components/lists/listBody.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 89c27ec7..03f88f63 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -743,9 +743,25 @@ BlazeComponent.extendComponent({
},
updateList() {
+ // Use fallback when requestIdleCallback is not available on iOS and Safari
+ // https://www.afasterweb.com/2017/11/20/utilizing-idle-moments/
+ checkIdleTime =
+ window.requestIdleCallback ||
+ function(handler) {
+ const startTime = Date.now();
+ return setTimeout(function() {
+ handler({
+ didTimeout: false,
+ timeRemaining() {
+ return Math.max(0, 50.0 - (Date.now() - startTime));
+ },
+ });
+ }, 1);
+ };
+
if (this.spinnerInView()) {
this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
- window.requestIdleCallback(() => this.updateList());
+ checkIdleTime(() => this.updateList());
}
},