Add OnDestroy to theme selector component, remove console log

This commit is contained in:
natsoni 2026-01-10 14:58:20 +01:00
parent c0891ead52
commit ddd996a9a5
No known key found for this signature in database
GPG key ID: C65917583181743B

View file

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, OnInit, OnDestroy } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { ThemeService } from '@app/services/theme.service';
import { Subscription } from 'rxjs';
@ -10,7 +10,7 @@ import { Subscription } from 'rxjs';
standalone: false,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ThemeSelectorComponent implements OnInit {
export class ThemeSelectorComponent implements OnInit, OnDestroy {
themeForm: UntypedFormGroup;
themes = ['default', 'contrast', 'softsimon', 'bukele'];
themeStateSubscription: Subscription;
@ -25,7 +25,6 @@ export class ThemeSelectorComponent implements OnInit {
theme: ['default']
});
this.themeStateSubscription = this.themeService.themeState$.subscribe(({ theme, loading }) => {
console.log('Theme state changed:', theme, loading);
this.themeForm.get('theme')?.setValue(theme, { emitEvent: false });
if (loading) {
this.themeForm.get('theme')?.disable({ emitEvent: false });