mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
onDestroy needed for broadcast subscriptions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
|
||||
@@ -25,7 +26,7 @@ const BroadcasterSubscriptionId = 'AddEditComponent';
|
||||
selector: 'app-vault-add-edit',
|
||||
templateUrl: 'add-edit.component.html',
|
||||
})
|
||||
export class AddEditComponent extends BaseAddEditComponent implements OnChanges {
|
||||
export class AddEditComponent extends BaseAddEditComponent implements OnChanges, OnDestroy {
|
||||
constructor(cipherService: CipherService, folderService: FolderService,
|
||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||
auditService: AuditService, stateService: StateService,
|
||||
@@ -55,6 +56,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
|
||||
await this.load();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||
}
|
||||
|
||||
async load() {
|
||||
if (document.querySelectorAll('app-vault-add-edit .ng-dirty').length === 0 ||
|
||||
(this.cipher != null && this.cipherId !== this.cipher.id)) {
|
||||
|
||||
Reference in New Issue
Block a user