From ca25d908e6939ae89ddc5e8b909ed3a2eb758849 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Fri, 22 May 2026 11:53:38 +0700 Subject: [PATCH] feat(client): convert benchmarks to signal --- .../app/components/home-market/home-market.component.ts | 9 ++++----- .../src/app/components/home-market/home-market.html | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/client/src/app/components/home-market/home-market.component.ts b/apps/client/src/app/components/home-market/home-market.component.ts index af4ac2588..b738b7c69 100644 --- a/apps/client/src/app/components/home-market/home-market.component.ts +++ b/apps/client/src/app/components/home-market/home-market.component.ts @@ -20,7 +20,8 @@ import { CUSTOM_ELEMENTS_SCHEMA, DestroyRef, inject, - OnInit + OnInit, + signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { DeviceDetectorService } from 'ngx-device-detector'; @@ -37,7 +38,7 @@ import { DeviceDetectorService } from 'ngx-device-detector'; templateUrl: './home-market.html' }) export class GfHomeMarketComponent implements OnInit { - protected benchmarks: Benchmark[]; + protected readonly benchmarks = signal([]); protected readonly deviceType = computed( () => this.deviceDetectorService.deviceInfo().deviceType ); @@ -106,9 +107,7 @@ export class GfHomeMarketComponent implements OnInit { .fetchBenchmarks() .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(({ benchmarks }) => { - this.benchmarks = benchmarks; - - this.changeDetectorRef.markForCheck(); + this.benchmarks.set(benchmarks); }); } } diff --git a/apps/client/src/app/components/home-market/home-market.html b/apps/client/src/app/components/home-market/home-market.html index 08693f34b..0409f20bb 100644 --- a/apps/client/src/app/components/home-market/home-market.html +++ b/apps/client/src/app/components/home-market/home-market.html @@ -31,13 +31,13 @@
- @if (benchmarks?.length > 0) { + @if (benchmarks()?.length > 0) {