@@ -245,13 +245,19 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
245245 } ;
246246
247247 async buildAllFilters ( ) : Promise < VaultFilterList > {
248- const userId = await firstValueFrom ( this . accountService . activeAccount$ . pipe ( getUserId ) ) ;
248+ const [ userId , showArchive ] = await firstValueFrom (
249+ combineLatest ( [
250+ this . accountService . activeAccount$ . pipe ( getUserId ) ,
251+ this . cipherArchiveService . showArchiveFeatures$ ( ) ,
252+ ] ) ,
253+ ) ;
254+
249255 const builderFilter = { } as VaultFilterList ;
250256 builderFilter . organizationFilter = await this . addOrganizationFilter ( ) ;
251257 builderFilter . typeFilter = await this . addTypeFilter ( ) ;
252258 builderFilter . folderFilter = await this . addFolderFilter ( ) ;
253259 builderFilter . collectionFilter = await this . addCollectionFilter ( ) ;
254- if ( await firstValueFrom ( this . cipherArchiveService . showArchiveFeatures$ ( ) ) ) {
260+ if ( showArchive ) {
255261 builderFilter . archiveFilter = await this . addArchiveFilter ( userId ) ;
256262 }
257263 builderFilter . trashFilter = await this . addTrashFilter ( ) ;
@@ -413,15 +419,16 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
413419 }
414420
415421 protected async addArchiveFilter ( userId : UserId ) : Promise < VaultFilterSection > {
416- const hasArchivedCiphers = await firstValueFrom (
417- this . cipherArchiveService
418- . archivedCiphers$ ( userId )
419- . pipe ( map ( ( archivedCiphers ) => archivedCiphers . length > 0 ) ) ,
422+ const [ hasArchivedCiphers , userHasPremium ] = await firstValueFrom (
423+ combineLatest ( [
424+ this . cipherArchiveService
425+ . archivedCiphers$ ( userId )
426+ . pipe ( map ( ( archivedCiphers ) => archivedCiphers . length > 0 ) ) ,
427+ this . cipherArchiveService . userHasPremium$ ( userId ) ,
428+ ] ) ,
420429 ) ;
421430
422- const userHasPremium = await firstValueFrom ( this . cipherArchiveService . userHasPremium$ ( userId ) ) ;
423-
424- const premiumPromptOnFilter = ! userHasPremium && ! hasArchivedCiphers ;
431+ const promptForPremiumOnFilter = ! userHasPremium && ! hasArchivedCiphers ;
425432
426433 const archiveFilterSection : VaultFilterSection = {
427434 data$ : this . vaultFilterService . buildTypeTree (
@@ -447,7 +454,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
447454 action : this . applyTypeFilter as ( filterNode : TreeNode < VaultFilterType > ) => Promise < void > ,
448455 premiumOptions : {
449456 showPremiumBadge : true ,
450- blockFilterAction : premiumPromptOnFilter
457+ blockFilterAction : promptForPremiumOnFilter
451458 ? async ( ) => await this . premiumUpgradePromptService . promptForPremium ( )
452459 : undefined ,
453460 } ,
0 commit comments