don't try to load more when end of timeline reached

This commit is contained in:
Bruno Windels 2021-09-10 14:17:40 +02:00
parent fe4bb5db40
commit 98cc1e2715

View File

@ -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");