From 98cc1e2715ebcaf1b0d2a5ee584d08d778246e2a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 10 Sep 2021 14:17:40 +0200 Subject: [PATCH] don't try to load more when end of timeline reached --- src/domain/session/room/timeline/TimelineViewModel.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/domain/session/room/timeline/TimelineViewModel.js b/src/domain/session/room/timeline/TimelineViewModel.js index 5db80976..222a05b7 100644 --- a/src/domain/session/room/timeline/TimelineViewModel.js +++ b/src/domain/session/room/timeline/TimelineViewModel.js @@ -83,10 +83,12 @@ export class TimelineViewModel extends ViewModel { } if (loadTop && !this._topLoadingPromise) { - this._topLoadingPromise = this._timeline.loadAtTop(10).then(() => { + this._topLoadingPromise = this._timeline.loadAtTop(10).then(hasReachedEnd => { this._topLoadingPromise = null; - // check if more items need to be loaded by recursing - this.setVisibleTileRange(this._startTile, this._endTile); + if (!hasReachedEnd) { + // check if more items need to be loaded by recursing + this.setVisibleTileRange(this._startTile, this._endTile); + } }); } else if (loadTop) { console.log("loadTop is true but already loading");