stop scrolling spam, fix #107
This commit is contained in:
parent
c83a464901
commit
b848e28f11
|
@ -19,6 +19,7 @@ import { StatusWrapper } from '../../../models/common.model';
|
|||
})
|
||||
export class StreamStatusesComponent implements OnInit, OnDestroy {
|
||||
isLoading = true;
|
||||
private lastInfinityFetchReturnedNothing = false;
|
||||
isThread = false;
|
||||
displayError: string;
|
||||
hasContentWarnings = false;
|
||||
|
@ -255,7 +256,7 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
private scrolledToBottom() {
|
||||
if (this.isLoading) return;
|
||||
if (this.isLoading || this.lastInfinityFetchReturnedNothing) return;
|
||||
|
||||
this.isLoading = true;
|
||||
this.isProcessingInfiniteScroll = true;
|
||||
|
@ -272,6 +273,10 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
const wrapper = new StatusWrapper(cwPolicy.status, this.account, cwPolicy.applyCw, cwPolicy.hide);
|
||||
this.statuses.push(wrapper);
|
||||
}
|
||||
|
||||
if(!status || status.length === 0){
|
||||
this.lastInfinityFetchReturnedNothing = true;
|
||||
}
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
this.notificationService.notifyHttpError(err, this.account);
|
||||
|
@ -318,6 +323,7 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
|||
private checkAndCleanUpStream(): void {
|
||||
if (this.streamPositionnedAtTop && this.statuses.length > 3 * this.streamingService.nbStatusPerIteration) {
|
||||
this.statuses.length = 2 * this.streamingService.nbStatusPerIteration;
|
||||
this.lastInfinityFetchReturnedNothing = false;
|
||||
}
|
||||
|
||||
if (this.bufferStream.length > 3 * this.streamingService.nbStatusPerIteration) {
|
||||
|
|
Loading…
Reference in New Issue