From af5a7fed9d7f26eb50c6635f6a6d016bd2ae0495 Mon Sep 17 00:00:00 2001 From: Basimohd Date: Wed, 25 Oct 2023 15:52:00 +0530 Subject: [PATCH] Fixed the analysis page error when deleting benchmark --- .../analysis/analysis-page.component.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index ddac55046..764d4b058 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -385,12 +385,18 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { } private updateBenchmarkDataItems() { - if (this.user.settings.benchmark) { - const { dataSource, symbol } = - this.benchmarks.find(({ id }) => { - return id === this.user.settings.benchmark; - }) ?? {}; + this.benchmarkDataItems = []; + this.isLoadingBenchmarkComparator = false; + if (!this.user.settings.benchmark) return; + + const { dataSource, symbol } = + this.benchmarks.find(({ id }) => { + return id === this.user.settings.benchmark; + }) ?? {}; + + if (dataSource && symbol) { + this.isLoadingBenchmarkComparator = true; this.dataService .fetchBenchmarkBySymbol({ dataSource, @@ -407,13 +413,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { }); this.isLoadingBenchmarkComparator = false; - - this.changeDetectorRef.markForCheck(); }); - } else { - this.benchmarkDataItems = []; - - this.isLoadingBenchmarkComparator = false; } } }