Merge pull request #513 from NicolasConstant/fix_item-count-slow-mode
Fix item count slow mode
This commit is contained in:
commit
0777c23124
|
@ -3,7 +3,7 @@ cache:
|
||||||
#- node_modules
|
#- node_modules
|
||||||
environment:
|
environment:
|
||||||
GH_TOKEN:
|
GH_TOKEN:
|
||||||
secure: wRRBU0GXTmTBgZBs2PGSaEJWOflynAyvp3Nc/7e9xmciPfkUCQAXcpOn0jIYmzpb
|
secure: eXSiJiDFgLi4vixO5GS93lgrqZ+BzQNy7PKPCQCErHjCQD9mWiEtVQQnhvmUq1FPLUc3fNLmOFQu2nIWA9bnkHg5Yw9WiG2m7QSCPRB+xCnvSY6JbLqpzURZp5x5OLj6
|
||||||
matrix:
|
matrix:
|
||||||
- nodejs_version: 10.9.0
|
- nodejs_version: 10.9.0
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -28,6 +28,7 @@ export abstract class TimelineBase extends BrowseBase {
|
||||||
statuses: StatusWrapper[] = [];
|
statuses: StatusWrapper[] = [];
|
||||||
bufferStream: Status[] = [];
|
bufferStream: Status[] = [];
|
||||||
protected bufferWasCleared: boolean;
|
protected bufferWasCleared: boolean;
|
||||||
|
numNewItems: number;
|
||||||
streamPositionnedAtTop: boolean = true;
|
streamPositionnedAtTop: boolean = true;
|
||||||
protected isProcessingInfiniteScroll: boolean;
|
protected isProcessingInfiniteScroll: boolean;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -101,6 +101,8 @@ export class StreamStatusesComponent extends TimelineBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.numNewItems = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -133,6 +135,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 +157,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 +205,7 @@ export class StreamStatusesComponent extends TimelineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bufferStream.length = 0;
|
this.bufferStream.length = 0;
|
||||||
|
this.numNewItems = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class ThreadComponent extends BrowseBase {
|
||||||
hasContentWarnings = false;
|
hasContentWarnings = false;
|
||||||
private remoteStatusFetchingDisabled = false;
|
private remoteStatusFetchingDisabled = false;
|
||||||
|
|
||||||
|
numNewItems: number; //html compatibility only
|
||||||
bufferStream: Status[] = []; //html compatibility only
|
bufferStream: Status[] = []; //html compatibility only
|
||||||
streamPositionnedAtTop: boolean = true; //html compatibility only
|
streamPositionnedAtTop: boolean = true; //html compatibility only
|
||||||
timelineLoadingMode: TimeLineModeEnum = TimeLineModeEnum.OnTop; //html compatibility only
|
timelineLoadingMode: TimeLineModeEnum = TimeLineModeEnum.OnTop; //html compatibility only
|
||||||
|
|
Loading…
Reference in New Issue