From 8dff57e89ea22389efa59cd5a147c0c9141037e5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 20 Dec 2018 10:16:19 -0500 Subject: [PATCH] unsub from query params route observable --- jslib | 2 +- src/app/vault/vault.component.ts | 64 ++++++++++++++++---------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/jslib b/jslib index aa17849329..cddeeefdbb 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit aa1784932945bfd1115f366cf5dafc6b481c19a3 +Subproject commit cddeeefdbb14d5f70020fb705885eb05a0bb4339 diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index e3b6514b0e..54f15794d3 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -163,45 +163,45 @@ export class VaultComponent implements OnInit, OnDestroy { } async load() { - this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async (params) => { await this.groupingsComponent.load(); if (params == null) { this.groupingsComponent.selectedAll = true; await this.ciphersComponent.load(); - return; - } - - if (params.cipherId) { - const cipherView = new CipherView(); - cipherView.id = params.cipherId; - if (params.action === 'edit') { - this.editCipher(cipherView); - } else { - this.viewCipher(cipherView); - } - } else if (params.action === 'add') { - this.addCipher(); - } - - if (params.favorites) { - this.groupingsComponent.selectedFavorites = true; - await this.filterFavorites(); - } else if (params.type) { - const t = parseInt(params.type, null); - this.groupingsComponent.selectedType = t; - await this.filterCipherType(t); - } else if (params.folderId) { - this.groupingsComponent.selectedFolder = true; - this.groupingsComponent.selectedFolderId = params.folderId; - await this.filterFolder(params.folderId); - } else if (params.collectionId) { - this.groupingsComponent.selectedCollectionId = params.collectionId; - await this.filterCollection(params.collectionId); } else { - this.groupingsComponent.selectedAll = true; - await this.ciphersComponent.load(); + if (params.cipherId) { + const cipherView = new CipherView(); + cipherView.id = params.cipherId; + if (params.action === 'edit') { + this.editCipher(cipherView); + } else { + this.viewCipher(cipherView); + } + } else if (params.action === 'add') { + this.addCipher(); + } + + if (params.favorites) { + this.groupingsComponent.selectedFavorites = true; + await this.filterFavorites(); + } else if (params.type) { + const t = parseInt(params.type, null); + this.groupingsComponent.selectedType = t; + await this.filterCipherType(t); + } else if (params.folderId) { + this.groupingsComponent.selectedFolder = true; + this.groupingsComponent.selectedFolderId = params.folderId; + await this.filterFolder(params.folderId); + } else if (params.collectionId) { + this.groupingsComponent.selectedCollectionId = params.collectionId; + await this.filterCollection(params.collectionId); + } else { + this.groupingsComponent.selectedAll = true; + await this.ciphersComponent.load(); + } } + queryParamsSub.unsubscribe(); }); }