From b962373f7151c0199fbe4b0b0c008a54ec442543 Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Mon, 23 Dec 2024 14:32:11 -0500 Subject: [PATCH] simplify and enspeeden state resolution for blockedInteractionsUris --- .../services/domain-settings.service.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libs/common/src/autofill/services/domain-settings.service.ts b/libs/common/src/autofill/services/domain-settings.service.ts index b61fd2bb997..b2e70bf0cc2 100644 --- a/libs/common/src/autofill/services/domain-settings.service.ts +++ b/libs/common/src/autofill/services/domain-settings.service.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { combineLatest, map, Observable } from "rxjs"; +import { map, Observable, switchMap, of } from "rxjs"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; @@ -97,18 +97,9 @@ export class DefaultDomainSettingsService implements DomainSettingsService { // Needs to be global to prevent pre-login injections this.blockedInteractionsUrisState = this.stateProvider.getGlobal(BLOCKED_INTERACTIONS_URIS); - this.blockedInteractionsUris$ = combineLatest([ - this.blockedInteractionsUrisState.state$, - this.configService?.getFeatureFlag$(FeatureFlag.BlockBrowserInjectionsByDomain), - ]).pipe( - map(([blockedUris, blockBrowserInjectionsByDomainEnabled]) => { - if (!blockBrowserInjectionsByDomainEnabled) { - return null; - } - - return blockedUris ?? null; - }), - ); + this.blockedInteractionsUris$ = this.configService + .getFeatureFlag$(FeatureFlag.BlockBrowserInjectionsByDomain) + .pipe(switchMap((enabled) => (enabled ? this.blockedInteractionsUrisState.state$ : of({})))); this.equivalentDomainsState = this.stateProvider.getActive(EQUIVALENT_DOMAINS); this.equivalentDomains$ = this.equivalentDomainsState.state$.pipe(map((x) => x ?? null));