1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-01 04:37:40 +02:00

unsub from queryParams observable

This commit is contained in:
Kyle Spearrin 2018-12-20 10:20:57 -05:00
parent 2a87fc14c2
commit fd5d47da7c
10 changed files with 19 additions and 10 deletions

2
jslib

@ -1 +1 @@
Subproject commit aa1784932945bfd1115f366cf5dafc6b481c19a3 Subproject commit cddeeefdbb14d5f70020fb705885eb05a0bb4339

View File

@ -24,11 +24,12 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent {
} }
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
if (params.folderId) { if (params.folderId) {
this.folderId = params.folderId; this.folderId = params.folderId;
} }
await super.ngOnInit(); await super.ngOnInit();
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -36,7 +36,7 @@ export class AddEditComponent extends BaseAddEditComponent {
async ngOnInit() { async ngOnInit() {
await super.ngOnInit(); await super.ngOnInit();
this.showAttachments = !this.platformUtilsService.isEdge(); this.showAttachments = !this.platformUtilsService.isEdge();
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
if (params.cipherId) { if (params.cipherId) {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
} }
@ -65,6 +65,7 @@ export class AddEditComponent extends BaseAddEditComponent {
this.cipher.login.uris[0].uri = params.uri; this.cipher.login.uris[0].uri = params.uri;
} }
} }
queryParamsSub.unsubscribe();
}); });
window.setTimeout(() => { window.setTimeout(() => {

View File

@ -23,9 +23,10 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
} }
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
await super.ngOnInit(); await super.ngOnInit();
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -72,7 +72,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
} }
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
if (params.type) { if (params.type) {
this.searchPlaceholder = this.i18nService.t('searchType'); this.searchPlaceholder = this.i18nService.t('searchType');
this.type = parseInt(params.type, null); this.type = parseInt(params.type, null);
@ -131,6 +131,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0); window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
} }
this.stateService.remove(ComponentId); this.stateService.remove(ComponentId);
queryParamsSub.unsubscribe();
}); });
this.broadcasterService.subscribe(ComponentId, (message: any) => { this.broadcasterService.subscribe(ComponentId, (message: any) => {

View File

@ -24,9 +24,10 @@ export class CollectionsComponent extends BaseCollectionsComponent {
this.onSavedCollections.subscribe(() => { this.onSavedCollections.subscribe(() => {
this.back(); this.back();
}); });
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
await super.ngOnInit(); await super.ngOnInit();
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -110,7 +110,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
}); });
const restoredScopeState = await this.restoreState(); const restoredScopeState = await this.restoreState();
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
this.state = (await this.stateService.get<any>(ComponentId)) || {}; this.state = (await this.stateService.get<any>(ComponentId)) || {};
if (this.state.searchText) { if (this.state.searchText) {
this.searchText = this.state.searchText; this.searchText = this.state.searchText;
@ -132,6 +132,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
if (!this.syncService.syncInProgress || restoredScopeState) { if (!this.syncService.syncInProgress || restoredScopeState) {
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0); window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
} }
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -22,7 +22,7 @@ export class PasswordHistoryComponent extends BasePasswordHistoryComponent {
} }
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
if (params.cipherId) { if (params.cipherId) {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
} else { } else {
@ -30,6 +30,7 @@ export class PasswordHistoryComponent extends BasePasswordHistoryComponent {
} }
await super.ngOnInit(); await super.ngOnInit();
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -29,9 +29,10 @@ export class ShareComponent extends BaseShareComponent {
this.onSharedCipher.subscribe(() => { this.onSharedCipher.subscribe(() => {
this.router.navigate(['view-cipher', { cipherId: this.cipherId }]); this.router.navigate(['view-cipher', { cipherId: this.cipherId }]);
}); });
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
await super.ngOnInit(); await super.ngOnInit();
queryParamsSub.unsubscribe();
}); });
} }

View File

@ -42,7 +42,7 @@ export class ViewComponent extends BaseViewComponent {
ngOnInit() { ngOnInit() {
this.showAttachments = !this.platformUtilsService.isEdge(); this.showAttachments = !this.platformUtilsService.isEdge();
this.route.queryParams.subscribe(async (params) => { const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
if (params.cipherId) { if (params.cipherId) {
this.cipherId = params.cipherId; this.cipherId = params.cipherId;
} else { } else {
@ -50,6 +50,7 @@ export class ViewComponent extends BaseViewComponent {
} }
await this.load(); await this.load();
queryParamsSub.unsubscribe();
}); });
super.ngOnInit(); super.ngOnInit();
} }