Skip to content

Commit 9e88c99

Browse files
committed
feat(open-alerts): optimize open alerts handling and improve local storage updates
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent 6c0c23c commit 9e88c99

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

frontend/src/app/data-management/alert-management/shared/services/open-alerts.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ export class OpenAlertsService implements OnDestroy {
3232
takeUntil(this.destroy$),
3333
switchMap(() => this.alertOpenStatusService.getOpenAlert()),
3434
tap((response) => {
35-
this.openAlerts = response.body;
36-
this.localStorage.store(OPEN_ALERTS_KEY, this.openAlerts);
37-
if (this.openAlerts >= 0 && this.openAlerts !== this.openAlerts) {
38-
this.openAlertsBehaviorSubject.next(this.openAlerts);
35+
const newValue = response.body;
36+
37+
if (newValue !== this.openAlerts) {
38+
this.openAlerts = newValue;
39+
this.openAlertsBehaviorSubject.next(newValue);
40+
this.localStorage.store(OPEN_ALERTS_KEY, newValue);
3941
}
4042
}),
4143
catchError((err) => {

0 commit comments

Comments
 (0)