From 3c830a31799dca52b8cffba37b061e38bf29d6a5 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Thu, 2 Oct 2025 11:38:02 +0300 Subject: [PATCH] LogoComponent improve init logic. --- ui-ngx/src/app/shared/components/logo.component.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/shared/components/logo.component.ts b/ui-ngx/src/app/shared/components/logo.component.ts index 1ac07612cb..1d32252069 100644 --- a/ui-ngx/src/app/shared/components/logo.component.ts +++ b/ui-ngx/src/app/shared/components/logo.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, Input, AfterViewInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { coerceBoolean } from '@shared/decorators/coercion'; import { AuthService } from '@core/auth/auth.service'; import { AppState } from '@core/core.state'; @@ -28,7 +28,7 @@ import { UrlHolder } from '@shared/pipe/image.pipe'; templateUrl: './logo.component.html', styleUrls: ['./logo.component.scss'] }) -export class LogoComponent implements AfterViewInit { +export class LogoComponent implements OnInit { @Input() @coerceBoolean() @@ -44,12 +44,10 @@ export class LogoComponent implements AfterViewInit { private store: Store) { } - ngAfterViewInit() { + ngOnInit() { if (!this.isLogin && !this.logoUrl) { - setTimeout(() => { - const authState = getCurrentAuthState(this.store); - this.logoUrl = this.authService.defaultUrl(true, authState); - }, 0); + const authState = getCurrentAuthState(this.store); + this.logoUrl = this.authService.defaultUrl(true, authState); } } }