[Refactor] Use rxjs first instead of unsubscribe from queryParams (#1105)

* Use rxjs first instead of unsubscribe

* Remove unneeded variable

* Update jslib
This commit is contained in:
Thomas Rittson 2021-10-15 07:59:08 +10:00 committed by GitHub
parent 7327ab75c9
commit 77ab177d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 10 deletions

2
jslib

@ -1 +1 @@
Subproject commit 764dc40b36e0000807e59b8d6feea5ac4577270d
Subproject commit a20e935268c986538ff68f72016bb8c772ea3a1b

View File

@ -12,6 +12,8 @@ import {
Router,
} from '@angular/router';
import { first } from 'rxjs/operators';
import { ToasterService } from 'angular2-toaster';
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
@ -174,12 +176,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
async load() {
let loaded = false;
const queryParamsSub = this.route.queryParams.subscribe(async params => {
if (loaded) {
return;
}
loaded = true;
this.route.queryParams.pipe(first()).subscribe(async params => {
await this.groupingsComponent.load();
if (params == null) {
@ -223,9 +220,6 @@ export class VaultComponent implements OnInit, OnDestroy {
await this.ciphersComponent.reload();
}
}
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
});
}