From c5c798f2f32a5b6ca1bec6bd77466d8037967b78 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Tue, 14 Jul 2026 09:38:13 +0700 Subject: [PATCH] fix(ui): resolve type errors --- .../home-holdings/home-holdings.component.ts | 8 ++++---- .../lib/treemap-chart/treemap-chart.component.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/client/src/app/components/home-holdings/home-holdings.component.ts b/apps/client/src/app/components/home-holdings/home-holdings.component.ts index cf7e52833..bae154607 100644 --- a/apps/client/src/app/components/home-holdings/home-holdings.component.ts +++ b/apps/client/src/app/components/home-holdings/home-holdings.component.ts @@ -58,7 +58,7 @@ export class GfHomeHoldingsComponent implements OnInit { protected hasImpersonationId: boolean; protected hasPermissionToAccessHoldingsChart: boolean; protected hasPermissionToCreateActivity: boolean; - protected holdings: PortfolioPosition[]; + protected holdings: PortfolioPosition[] | undefined; protected holdingType: HoldingType = 'ACTIVE'; protected readonly holdingTypeOptions: ToggleOption[] = [ { label: $localize`Active`, value: 'ACTIVE' }, @@ -181,8 +181,8 @@ export class GfHomeHoldingsComponent implements OnInit { this.viewModeFormControl.setValue( this.deviceType === 'mobile' ? GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE - : this.user?.settings?.holdingsViewMode || - GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE, + : (this.user?.settings?.holdingsViewMode ?? + GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE), { emitEvent: false } ); } else if (this.holdingType === 'CLOSED') { @@ -192,7 +192,7 @@ export class GfHomeHoldingsComponent implements OnInit { ); } - this.holdings = []; + this.holdings = undefined; this.fetchHoldings() .pipe(takeUntilDestroyed(this.destroyRef)) diff --git a/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts b/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts index fd4e63f29..5bccf9272 100644 --- a/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts +++ b/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts @@ -56,7 +56,7 @@ export class GfTreemapChartComponent @Input() colorScheme: ColorScheme; @Input() cursor: string; @Input() dateRange: DateRange; - @Input() holdings: PortfolioPosition[]; + @Input() holdings: PortfolioPosition[] | undefined; @Input() locale = getLocale(); @Output() treemapChartClicked = new EventEmitter(); @@ -70,15 +70,11 @@ export class GfTreemapChartComponent Chart.register(LinearScale, Tooltip, TreemapController, TreemapElement); } public ngAfterViewInit() { - if (this.holdings) { - this.initialize(); - } + this.initialize(); } public ngOnChanges() { - if (this.holdings) { - this.initialize(); - } + this.initialize(); } public ngOnDestroy() { @@ -159,6 +155,10 @@ export class GfTreemapChartComponent } private initialize() { + if (!this.holdings) { + return; + } + this.isLoading = true; const { endDate, startDate } = getIntervalFromDateRange({