don't update stream if not modified

This commit is contained in:
Nicolas Constant 2019-06-24 14:22:42 -04:00
parent cbcc1f85e1
commit e6f8d9f855
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 16 additions and 1 deletions

View File

@ -31,6 +31,10 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
private bufferStream: Status[] = [];
private bufferWasCleared: boolean;
private hideBoosts: boolean;
private hideReplies: boolean;
private hideBots: boolean;
@Output() browseAccountEvent = new EventEmitter<string>();
@Output() browseHashtagEvent = new EventEmitter<string>();
@Output() browseThreadEvent = new EventEmitter<OpenThreadEvent>();
@ -38,6 +42,11 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
@Input()
set streamElement(streamElement: StreamElement) {
this._streamElement = streamElement;
this.hideBoosts = streamElement.hideBoosts;
this.hideBots = streamElement.hideBots;
this.hideReplies = streamElement.hideReplies;
this.load(this._streamElement);
}
get streamElement(): StreamElement {
@ -68,7 +77,13 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
});
this.streamsSubscription = this.streams$.subscribe((streams: StreamElement[]) => {
this.streamElement = streams.find(x => x.id === this.streamElement.id);
let updatedStream = streams.find(x => x.id === this.streamElement.id);
if (this.hideBoosts !== updatedStream.hideBoosts
|| this.hideBots !== updatedStream.hideBots
|| this.hideReplies !== updatedStream.hideReplies) {
this.streamElement = updatedStream;
}
});
}