1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-19 10:54:00 +00:00

[PM-29313] [Defect] TDE JIT Provisioning - Extension showing locked icon even if user already logged in (#18672)

* fix: add better error handling to badge service

* fix: lint
This commit is contained in:
Andreas Coroiu
2026-02-10 15:11:12 +01:00
committed by jaasen-livefront
parent 73bdd60644
commit 8855884644

View File

@@ -1,5 +1,6 @@
import {
BehaviorSubject,
catchError,
combineLatest,
combineLatestWith,
concatMap,
@@ -73,9 +74,25 @@ export class BadgeService {
map((evt) => evt.tab),
combineLatestWith(this.stateFunctions),
switchMap(([tab, dynamicStateFunctions]) => {
const functions = [...Object.values(dynamicStateFunctions), defaultTabStateFunction];
const functions = [
...Object.entries(dynamicStateFunctions),
["default" as string, defaultTabStateFunction] as const,
];
return combineLatest(functions.map((f) => f(tab).pipe(startWith(undefined)))).pipe(
return combineLatest(
functions.map(([name, f]) =>
f(tab).pipe(
startWith(undefined),
catchError((error: unknown) => {
this.logService.error(
`BadgeService: State function "${name}" threw an error`,
error,
);
return of(undefined);
}),
),
),
).pipe(
map((states) => ({
tab,
states: states.filter((s): s is BadgeStateSetting => s !== undefined),