refactor(settings): replace unsubscribe logic with takeUntilDestroyed for better resource management (#443)
* refactor(settings): replace unsubscribe logic with takeUntilDestroyed for better resource management * refactor(settings): streamline saveSettings method and improve error handling * fix(settings): improve error handling in saveSetting method * refactor(settings): update tab structure * refactor(settings): implement OnDestroy interface and clean up unused destroyRef instances
This commit is contained in:
@@ -17,6 +17,7 @@ export class NotificationEventService {
|
||||
notificationHighlight$ = this.notificationHighlightSubject.asObservable();
|
||||
|
||||
private highlightTimeout: ReturnType<typeof setTimeout> | undefined;
|
||||
private clearTimeout: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
handleNewNotification(notification: LogNotification): void {
|
||||
this.latestNotificationSubject.next(notification);
|
||||
@@ -25,12 +26,15 @@ export class NotificationEventService {
|
||||
if (this.highlightTimeout) {
|
||||
clearTimeout(this.highlightTimeout);
|
||||
}
|
||||
if (this.clearTimeout) {
|
||||
clearTimeout(this.clearTimeout);
|
||||
}
|
||||
|
||||
this.highlightTimeout = setTimeout(() => {
|
||||
this.notificationHighlightSubject.next(false);
|
||||
}, 7500);
|
||||
|
||||
setTimeout(() => {
|
||||
this.clearTimeout = setTimeout(() => {
|
||||
if (!this.notificationHighlightSubject.value) {
|
||||
this.latestNotificationSubject.next(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user