don't override newly requested ranges when retrying loadattop

This commit is contained in:
Bruno Windels 2021-09-10 15:25:19 +02:00
parent 9411e6f065
commit 5c40b75eab

View File

@ -50,6 +50,8 @@ export class TimelineViewModel extends ViewModel {
/** if this.tiles is empty, call this with undefined for both startTile and endTile */ /** if this.tiles is empty, call this with undefined for both startTile and endTile */
setVisibleTileRange(startTile, endTile) { setVisibleTileRange(startTile, endTile) {
// don't clear these once done as they are used to check
// for more tiles once loadAtTop finishes
this._requestedStartTile = startTile; this._requestedStartTile = startTile;
this._requestedEndTile = endTile; this._requestedEndTile = endTile;
if (!this._requestScheduled) { if (!this._requestScheduled) {
@ -85,7 +87,9 @@ export class TimelineViewModel extends ViewModel {
this._topLoadingPromise = null; this._topLoadingPromise = null;
if (!hasReachedEnd) { if (!hasReachedEnd) {
// check if more items need to be loaded by recursing // check if more items need to be loaded by recursing
this.setVisibleTileRange(this._startTile, this._endTile); // use the requested start / end tile,
// so we don't end up overwriting a newly requested visible range here
this.setVisibleTileRange(this._requestedStartTile, this._requestedEndTile);
} }
}); });
} else if (loadTop) { } else if (loadTop) {