Merge pull request #499 from rpetti/fix-slow-mode-new-item-count
fix new item count in slow mode
This commit is contained in:
commit
30c81ae143
@ -11,8 +11,8 @@
|
|||||||
<div class="stream-toots__content flexcroll" #statusstream (scroll)="onScroll()" tabindex="0">
|
<div class="stream-toots__content flexcroll" #statusstream (scroll)="onScroll()" tabindex="0">
|
||||||
<div *ngIf="displayError" class="stream-toots__error">{{displayError}}</div>
|
<div *ngIf="displayError" class="stream-toots__error">{{displayError}}</div>
|
||||||
|
|
||||||
<div *ngIf="timelineLoadingMode === 3 && bufferStream && bufferStream.length > 0">
|
<div *ngIf="timelineLoadingMode === 3 && bufferStream && numNewItems > 0">
|
||||||
<a href (click)="loadBuffer()" class="stream-toots__load-buffer" title="load new items">{{ bufferStream.length }} new item<span *ngIf="bufferStream.length > 1">s</span></a>
|
<a href (click)="loadBuffer()" class="stream-toots__load-buffer" title="load new items">{{ numNewItems }} new item<span *ngIf="numNewItems > 1">s</span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses" #status>
|
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses" #status>
|
||||||
|
@ -43,6 +43,8 @@ export class StreamStatusesComponent extends TimelineBase {
|
|||||||
private deleteStatusSubscription: Subscription;
|
private deleteStatusSubscription: Subscription;
|
||||||
private streams$: Observable<StreamElement[]>;
|
private streams$: Observable<StreamElement[]>;
|
||||||
|
|
||||||
|
numNewItems: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected readonly settingsService: SettingsService,
|
protected readonly settingsService: SettingsService,
|
||||||
protected readonly store: Store,
|
protected readonly store: Store,
|
||||||
@ -101,6 +103,8 @@ export class StreamStatusesComponent extends TimelineBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.numNewItems = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@ -133,6 +137,7 @@ export class StreamStatusesComponent extends TimelineBase {
|
|||||||
private resetStream() {
|
private resetStream() {
|
||||||
this.statuses.length = 0;
|
this.statuses.length = 0;
|
||||||
this.bufferStream.length = 0;
|
this.bufferStream.length = 0;
|
||||||
|
this.numNewItems = 0;
|
||||||
if (this.websocketStreaming) this.websocketStreaming.dispose();
|
if (this.websocketStreaming) this.websocketStreaming.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +159,7 @@ export class StreamStatusesComponent extends TimelineBase {
|
|||||||
this.statuses.unshift(wrapper);
|
this.statuses.unshift(wrapper);
|
||||||
} else {
|
} else {
|
||||||
this.bufferStream.push(update.status);
|
this.bufferStream.push(update.status);
|
||||||
|
this.numNewItems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (update.type === EventEnum.delete) {
|
} else if (update.type === EventEnum.delete) {
|
||||||
@ -201,6 +207,7 @@ export class StreamStatusesComponent extends TimelineBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.bufferStream.length = 0;
|
this.bufferStream.length = 0;
|
||||||
|
this.numNewItems = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user