1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

[PM-27291] preserve critical app flags when generating new reports (#17008)

This commit is contained in:
Alex
2025-10-24 12:20:40 -04:00
committed by GitHub
parent fc26a21b85
commit f5f9d1881e

View File

@@ -101,6 +101,8 @@ export class RiskInsightsOrchestratorService {
// --------------------------- Trigger subjects --------------------- // --------------------------- Trigger subjects ---------------------
private _initializeOrganizationTriggerSubject = new Subject<OrganizationId>(); private _initializeOrganizationTriggerSubject = new Subject<OrganizationId>();
private _fetchReportTriggerSubject = new Subject<void>(); private _fetchReportTriggerSubject = new Subject<void>();
private _markUnmarkUpdatesSubject = new Subject<ReportState>();
private _markUnmarkUpdates$ = this._markUnmarkUpdatesSubject.asObservable();
private _reportStateSubscription: Subscription | null = null; private _reportStateSubscription: Subscription | null = null;
private _migrationSubscription: Subscription | null = null; private _migrationSubscription: Subscription | null = null;
@@ -236,7 +238,9 @@ export class RiskInsightsOrchestratorService {
) )
.pipe( .pipe(
map(() => updatedState), map(() => updatedState),
tap((finalState) => this._rawReportDataSubject.next(finalState)), tap((finalState) => {
this._markUnmarkUpdatesSubject.next(finalState);
}),
catchError((error: unknown) => { catchError((error: unknown) => {
this.logService.error("Failed to save updated applicationData", error); this.logService.error("Failed to save updated applicationData", error);
return of({ ...reportState, error: "Failed to remove a critical application" }); return of({ ...reportState, error: "Failed to remove a critical application" });
@@ -318,7 +322,9 @@ export class RiskInsightsOrchestratorService {
) )
.pipe( .pipe(
map(() => updatedState), map(() => updatedState),
tap((finalState) => this._rawReportDataSubject.next(finalState)), tap((finalState) => {
this._markUnmarkUpdatesSubject.next(finalState);
}),
catchError((error: unknown) => { catchError((error: unknown) => {
this.logService.error("Failed to save updated applicationData", error); this.logService.error("Failed to save updated applicationData", error);
return of({ ...reportState, error: "Failed to save critical applications" }); return of({ ...reportState, error: "Failed to save critical applications" });
@@ -402,10 +408,10 @@ export class RiskInsightsOrchestratorService {
}, },
}; };
}), }),
catchError(() => { catchError((): Observable<ReportState> => {
return of({ loading: false, error: "Failed to generate or save report", data: null }); return of({ loading: false, error: "Failed to generate or save report", data: null });
}), }),
startWith({ loading: true, error: null, data: null }), startWith<ReportState>({ loading: true, error: null, data: null }),
); );
} }
@@ -714,6 +720,7 @@ export class RiskInsightsOrchestratorService {
initialReportLoad$, initialReportLoad$,
manualReportFetch$, manualReportFetch$,
newReportGeneration$, newReportGeneration$,
this._markUnmarkUpdates$,
).pipe( ).pipe(
scan((prevState: ReportState, currState: ReportState) => ({ scan((prevState: ReportState, currState: ReportState) => ({
...prevState, ...prevState,