Browse Source

Fix missing loading indicator in benchmark component

pull/7634/head
Thomas Kaul 2 weeks ago
parent
commit
7772507bfa
  1. 13
      apps/client/src/app/components/home-watchlist/home-watchlist.component.ts
  2. 2
      apps/client/src/app/components/markets/markets.component.ts
  3. 2
      apps/client/src/app/components/markets/markets.html
  4. 4
      libs/ui/src/lib/benchmark/benchmark.component.ts

13
apps/client/src/app/components/home-watchlist/home-watchlist.component.ts

@ -128,10 +128,17 @@ export class GfHomeWatchlistComponent implements OnInit {
this.dataService
.fetchWatchlist()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ watchlist }) => {
this.watchlist = watchlist;
.subscribe({
error: () => {
this.watchlist = [];
this.changeDetectorRef.markForCheck();
},
next: ({ watchlist }) => {
this.watchlist = watchlist ?? [];
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.markForCheck();
}
});
}

2
apps/client/src/app/components/markets/markets.component.ts

@ -122,7 +122,7 @@ export class GfMarketsComponent implements OnInit {
this.benchmarks.set([]);
},
next: ({ benchmarks }) => {
this.benchmarks.set(benchmarks);
this.benchmarks.set(benchmarks ?? []);
}
});
}

2
apps/client/src/app/components/markets/markets.html

@ -56,7 +56,7 @@
[showSymbol]="false"
[user]="user"
/>
@if ((benchmarks()?.length ?? 0) > 0) {
@if (benchmarks()?.length) {
<div
class="gf-text-wrap-balance line-height-1 mt-3 text-center text-muted"
>

4
libs/ui/src/lib/benchmark/benchmark.component.ts

@ -63,7 +63,7 @@ import { BenchmarkDetailDialogParams } from './benchmark-detail-dialog/interface
templateUrl: './benchmark.component.html'
})
export class GfBenchmarkComponent {
public readonly benchmarks = input.required<Benchmark[] | undefined>();
public readonly benchmarks = input<Benchmark[]>();
public readonly deviceType = input.required<string>();
public readonly hasPermissionToDeleteItem = input<boolean>();
public readonly locale = input(getLocale());
@ -115,6 +115,8 @@ export class GfBenchmarkComponent {
this.dataSource.sortingDataAccessor = getLowercase;
this.dataSource.sort = this.sort() ?? null;
} else {
this.dataSource.data = [];
}
});

Loading…
Cancel
Save