From 607d136d0c87d190ccc82e774a091b8316c5ac0d Mon Sep 17 00:00:00 2001 From: jaasen-livefront Date: Tue, 10 Feb 2026 15:37:22 -0800 Subject: [PATCH] remove unnecessary optional chain --- .../vault/individual-vault/vault.component.ts | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index 99975b8bfaa..5e6474d2805 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -224,7 +224,7 @@ export class VaultComponent implements OnInit, OnDestr this.organizations$, ]).pipe( map(([searchText, filter, organizations]) => { - const selectedOrg = organizations?.find((org) => org.id === filter.organizationId); + const selectedOrg = organizations.find((org) => org.id === filter.organizationId); const isOrgDisabled = selectedOrg && !selectedOrg.enabled; if (isOrgDisabled) { @@ -479,7 +479,7 @@ export class VaultComponent implements OnInit, OnDestr collections, filter.collectionId, ); - searchableCollectionNodes = selectedCollection?.children ?? []; + searchableCollectionNodes = selectedCollection.children; } if (await this.searchService.isSearchable(activeUserId, searchText)) { @@ -618,12 +618,12 @@ export class VaultComponent implements OnInit, OnDestr this.collections = collections; this.selectedCollection = selectedCollection; - this.canCreateCollections = allOrganizations?.some( + this.canCreateCollections = allOrganizations.some( (o) => o.canCreateNewCollections && !o.isProviderUser, ); this.showBulkMove = filter.type !== "trash"; - this.isEmpty = collections?.length === 0 && ciphers?.length === 0; + this.isEmpty = collections.length === 0 && ciphers.length === 0; this.performingInitialLoad = false; this.refreshing = false; @@ -891,7 +891,7 @@ export class VaultComponent implements OnInit, OnDestr * @returns */ async editCipherAttachments(cipher: C) { - if (cipher?.reprompt !== 0 && !(await this.passwordRepromptService.showPasswordPrompt())) { + if (cipher.reprompt !== 0 && !(await this.passwordRepromptService.showPasswordPrompt())) { await this.go({ cipherId: null, itemId: null }); return; } @@ -1001,7 +1001,7 @@ export class VaultComponent implements OnInit, OnDestr } async editCipher(cipher: CipherView | CipherListView, cloneMode?: boolean) { - return this.editCipherId(uuidAsString(cipher?.id), cloneMode); + return this.editCipherId(uuidAsString(cipher.id), cloneMode); } /** @@ -1114,7 +1114,7 @@ export class VaultComponent implements OnInit, OnDestr async editCollection(c: CollectionView, tab: CollectionDialogTabType): Promise { const dialog = openCollectionDialog(this.dialogService, { data: { - collectionId: c?.id, + collectionId: c.id, organizationId: c.organizationId, initialTab: tab, limitNestedCollections: true, @@ -1212,8 +1212,9 @@ export class VaultComponent implements OnInit, OnDestr if (orgId && orgId !== "MyVault") { const organization = this.allOrganizations.find((o) => o.id === orgId); - availableCollections = - this.allCollections?.filter((c) => c.organizationId === organization?.id) ?? []; + availableCollections = this.allCollections.filter( + (c) => c.organizationId === organization?.id, + ); } let ciphersToAssign: CipherView[]; @@ -1240,7 +1241,7 @@ export class VaultComponent implements OnInit, OnDestr ciphers: ciphersToAssign, organizationId: orgId as OrganizationId, availableCollections, - activeCollection: this.activeFilter?.selectedCollectionNode?.node, + activeCollection: this.activeFilter.selectedCollectionNode?.node, }, }); @@ -1598,13 +1599,13 @@ export class VaultComponent implements OnInit, OnDestr */ private async getPasswordFromCipherViewLike(cipher: C): Promise { if (!CipherViewLikeUtils.isCipherListView(cipher)) { - return Promise.resolve(cipher.login?.password); + return Promise.resolve(cipher.login.password); } const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); const _cipher = await this.cipherService.get(uuidAsString(cipher.id), activeUserId); const cipherView = await this.cipherService.decrypt(_cipher, activeUserId); - return cipherView.login?.password; + return cipherView.login.password; } private async openAutoConfirmFeatureDialog(organization: Organization) { @@ -1642,7 +1643,7 @@ export class VaultComponent implements OnInit, OnDestr organization$, ]).pipe( map( - ([policy, organization]) => (policy && policy.organizationId === organization?.id) ?? false, + ([policy, organization]) => (policy && policy.organizationId === organization.id) ?? false, ), );