diff --git a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/domain/risk-insights-orchestrator.service.ts b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/domain/risk-insights-orchestrator.service.ts index b9df2748e85..f52ab68985b 100644 --- a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/domain/risk-insights-orchestrator.service.ts +++ b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/domain/risk-insights-orchestrator.service.ts @@ -101,6 +101,8 @@ export class RiskInsightsOrchestratorService { // --------------------------- Trigger subjects --------------------- private _initializeOrganizationTriggerSubject = new Subject(); private _fetchReportTriggerSubject = new Subject(); + private _markUnmarkUpdatesSubject = new Subject(); + private _markUnmarkUpdates$ = this._markUnmarkUpdatesSubject.asObservable(); private _reportStateSubscription: Subscription | null = null; private _migrationSubscription: Subscription | null = null; @@ -236,7 +238,9 @@ export class RiskInsightsOrchestratorService { ) .pipe( map(() => updatedState), - tap((finalState) => this._rawReportDataSubject.next(finalState)), + tap((finalState) => { + this._markUnmarkUpdatesSubject.next(finalState); + }), catchError((error: unknown) => { this.logService.error("Failed to save updated applicationData", error); return of({ ...reportState, error: "Failed to remove a critical application" }); @@ -318,7 +322,9 @@ export class RiskInsightsOrchestratorService { ) .pipe( map(() => updatedState), - tap((finalState) => this._rawReportDataSubject.next(finalState)), + tap((finalState) => { + this._markUnmarkUpdatesSubject.next(finalState); + }), catchError((error: unknown) => { this.logService.error("Failed to save updated applicationData", error); return of({ ...reportState, error: "Failed to save critical applications" }); @@ -402,10 +408,10 @@ export class RiskInsightsOrchestratorService { }, }; }), - catchError(() => { + catchError((): Observable => { return of({ loading: false, error: "Failed to generate or save report", data: null }); }), - startWith({ loading: true, error: null, data: null }), + startWith({ loading: true, error: null, data: null }), ); } @@ -714,6 +720,7 @@ export class RiskInsightsOrchestratorService { initialReportLoad$, manualReportFetch$, newReportGeneration$, + this._markUnmarkUpdates$, ).pipe( scan((prevState: ReportState, currState: ReportState) => ({ ...prevState,