From 69b2972e56f4865788d951229d79f038cfceb768 Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Tue, 18 Mar 2025 16:42:02 -0400 Subject: [PATCH] [PM-19244] add missing null check, fix feature flag logic, cleanup (#13850) * add missing null check, fix feature flag logic, cleanup * add null check --- .../vault-header/vault-header.component.ts | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts index 489f42649f9..e9122864447 100644 --- a/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts @@ -219,23 +219,24 @@ export class VaultHeaderComponent implements OnInit { } async addCollection(): Promise { - const organization = this.organizations?.find( - (org) => org.productTierType === ProductTierType.Free, - ); const isBreadcrumbEventLogsEnabled = await firstValueFrom( this.configService.getFeatureFlag$(FeatureFlag.PM12276_BreadcrumbEventLogs), ); - if ( - this.organizations.length == 1 && - organization.productTierType === ProductTierType.Free && - isBreadcrumbEventLogsEnabled - ) { - const collections = await this.collectionAdminService.getAll(organization.id); - if (collections.length === organization.maxCollections) { - await this.showFreeOrgUpgradeDialog(organization); - return; + + if (isBreadcrumbEventLogsEnabled) { + const organization = this.organizations?.find( + (org) => org.productTierType === ProductTierType.Free, + ); + + if (this.organizations?.length == 1 && !!organization) { + const collections = await this.collectionAdminService.getAll(organization.id); + if (collections.length === organization.maxCollections) { + await this.showFreeOrgUpgradeDialog(organization); + return; + } } } + this.onAddCollection.emit(); }