From fce534d1426dfc2a31221ed903e961e64d152673 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 15 Aug 2026 13:52:36 +0200 Subject: [PATCH] Fix missing loading indicator in benchmark component --- .../src/app/components/markets/markets.component.ts | 9 +++++++-- apps/client/src/app/components/markets/markets.html | 2 +- libs/ui/src/lib/benchmark/benchmark.component.html | 2 +- libs/ui/src/lib/benchmark/benchmark.component.ts | 11 +++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/client/src/app/components/markets/markets.component.ts b/apps/client/src/app/components/markets/markets.component.ts index 02a043c4a..f4cc79287 100644 --- a/apps/client/src/app/components/markets/markets.component.ts +++ b/apps/client/src/app/components/markets/markets.component.ts @@ -117,8 +117,13 @@ export class GfMarketsComponent implements OnInit { this.dataService .fetchBenchmarks() .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(({ benchmarks }) => { - this.benchmarks.set(benchmarks); + .subscribe({ + error: () => { + this.benchmarks.set([]); + }, + next: ({ benchmarks }) => { + this.benchmarks.set(benchmarks); + } }); } diff --git a/apps/client/src/app/components/markets/markets.html b/apps/client/src/app/components/markets/markets.html index bd9013a00..2fb9c3246 100644 --- a/apps/client/src/app/components/markets/markets.html +++ b/apps/client/src/app/components/markets/markets.html @@ -56,7 +56,7 @@ [showSymbol]="false" [user]="user" /> - @if (benchmarks()?.length > 0) { + @if ((benchmarks()?.length ?? 0) > 0) {
diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index 296e0ce17..556b9875f 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -216,7 +216,7 @@
-@if (isLoading) { +@if (isLoading()) { (); + public readonly benchmarks = input.required(); public readonly deviceType = input.required(); public readonly hasPermissionToDeleteItem = input(); public readonly locale = input(getLocale()); @@ -76,6 +76,7 @@ export class GfBenchmarkComponent { protected readonly sort = viewChild(MatSort); protected readonly dataSource = new MatTableDataSource([]); + protected readonly displayedColumns = computed(() => { return [ ...(this.showIcon() ? ['icon'] : []), @@ -89,7 +90,11 @@ export class GfBenchmarkComponent { 'actions' ]; }); - protected isLoading = true; + + protected readonly isLoading = computed(() => { + return !this.benchmarks(); + }); + protected readonly isNumber = isNumber; protected readonly resolveMarketCondition = resolveMarketCondition; protected readonly round = round; @@ -110,8 +115,6 @@ export class GfBenchmarkComponent { this.dataSource.sortingDataAccessor = getLowercase; this.dataSource.sort = this.sort() ?? null; - - this.isLoading = false; } });