From 4553254134bc5f8a3079c13e9e67a097c6bba0b0 Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 3 Sep 2026 12:33:36 +0530 Subject: [PATCH] fix(benchmark): resolve stuck loading state in detail dialog on fetch error When the market data API call failed for an ETF watchlist item, the isLoading flag was never set to false because the subscribe() call had no error handler. The loading spinner remained indefinitely. Added an error callback that clears historicalDataItems, sets isLoading to false, and triggers change detection so the dialog renders an empty state instead of freezing. Fixes #7560 --- .../benchmark-detail-dialog.component.ts | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.component.ts b/libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.component.ts index 8a7e13156..9739a6f56 100644 --- a/libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.component.ts +++ b/libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.component.ts @@ -64,26 +64,34 @@ export class GfBenchmarkDetailDialogComponent implements OnInit { symbol: this.data.symbol }) .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(({ assetProfile, marketData }) => { - this.assetProfile = assetProfile; + .subscribe({ + next: ({ assetProfile, marketData }) => { + this.assetProfile = assetProfile; - this.historicalDataItems = marketData.map( - ({ date, marketPrice }, index) => { - if (marketData.length - 1 === index) { - this.value = marketPrice; - } + this.historicalDataItems = marketData.map( + ({ date, marketPrice }, index) => { + if (marketData.length - 1 === index) { + this.value = marketPrice; + } - return { - date: format(date, DATE_FORMAT), - value: marketPrice - }; - } - ); + return { + date: format(date, DATE_FORMAT), + value: marketPrice + }; + } + ); - this.isLoading = false; + this.isLoading = false; - this.changeDetectorRef.markForCheck(); - }); + this.changeDetectorRef.markForCheck(); + }, + error: () => { + this.historicalDataItems = []; + this.isLoading = false; + + this.changeDetectorRef.markForCheck(); + } +}); } public onClose() {