Don't overwrite cursor when fetching more recent

This commit is contained in:
Eric Amodio 2020-05-07 03:31:22 -04:00
parent 3a04fccaf8
commit 5b444df970

View file

@ -100,7 +100,7 @@ class TimelineAggregate {
return this.items[this.items.length - 1];
}
add(timeline: Timeline) {
add(timeline: Timeline, options: TimelineOptions) {
let updated = false;
if (timeline.items.length !== 0 && this.items.length !== 0) {
@ -139,7 +139,10 @@ class TimelineAggregate {
this.items.push(...timeline.items);
}
this._cursor = timeline.paging?.cursor;
// If we are not requesting more recent items than we have, then update the cursor
if (options.cursor !== undefined || typeof options.limit !== 'object') {
this._cursor = timeline.paging?.cursor;
}
if (updated) {
this.items.sort(
@ -626,7 +629,7 @@ export class TimelinePane extends ViewPane {
updated = true;
}
else {
updated = timeline.add(response);
updated = timeline.add(response, request.options);
}
if (updated) {
@ -923,6 +926,10 @@ export class TimelinePane extends ViewPane {
}
private loadMore(item: LoadMoreCommand) {
if (item.loading) {
return;
}
item.loading = true;
this.tree.rerender(item);