From 0a2282f4baaa25ef800b73d9fa717ae38f85610d Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 27 Jul 2015 12:16:05 +0930 Subject: [PATCH] Make sure pages loading count is kept in sync --- framework/core/js/forum/src/components/PostStream.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/core/js/forum/src/components/PostStream.js b/framework/core/js/forum/src/components/PostStream.js index e9497eac0..d14894541 100644 --- a/framework/core/js/forum/src/components/PostStream.js +++ b/framework/core/js/forum/src/components/PostStream.js @@ -301,7 +301,11 @@ class PostStream extends mixin(Component, evented) { const twoPagesAway = start - this.constructor.loadCount * 2; if (twoPagesAway > this.visibleStart && twoPagesAway >= 0) { this.visibleStart = twoPagesAway + this.constructor.loadCount + 1; - clearTimeout(this.loadPageTimeouts[twoPagesAway]); + + if (this.loadPageTimeouts[twoPagesAway]) { + clearTimeout(this.loadPageTimeouts[twoPagesAway]); + this.pagesLoading--; + } } this.loadPage(start, end); @@ -319,7 +323,11 @@ class PostStream extends mixin(Component, evented) { const twoPagesAway = start + this.constructor.loadCount * 2; if (twoPagesAway < this.visibleEnd && twoPagesAway <= this.count()) { this.visibleEnd = twoPagesAway; - clearTimeout(this.loadPageTimeouts[twoPagesAway]); + + if (this.loadPageTimeouts[twoPagesAway]) { + clearTimeout(this.loadPageTimeouts[twoPagesAway]); + this.pagesLoading--; + } } this.loadPage(start, end, true);