From 01103ba0155c0a2cacac478b14bbb28a8d7c5d3f Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 23 May 2026 15:41:04 +0700 Subject: [PATCH] feat(client): resolve errors --- .../home-overview/home-overview.component.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.ts index 4b5dc2a50..11c7403bf 100644 --- a/apps/client/src/app/components/home-overview/home-overview.component.ts +++ b/apps/client/src/app/components/home-overview/home-overview.component.ts @@ -3,6 +3,7 @@ import { LayoutService } from '@ghostfolio/client/core/layout.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { + DEFAULT_CURRENCY, DEFAULT_DATE_RANGE, NUMERICAL_PRECISION_THRESHOLD_6_FIGURES } from '@ghostfolio/common/config'; @@ -47,7 +48,7 @@ export class GfHomeOverviewComponent implements OnInit { public hasError: boolean; public hasImpersonationId: boolean; public hasPermissionToCreateActivity: boolean; - public historicalDataItems: LineChartItem[]; + public historicalDataItems: LineChartItem[] | null; public isAllTimeHigh: boolean; public isAllTimeLow: boolean; public isLoadingPerformance = true; @@ -94,7 +95,9 @@ export class GfHomeOverviewComponent implements OnInit { !this.user.settings.isRestrictedView && this.user.settings.viewMode !== 'ZEN'; - this.unit = this.showDetails ? this.user.settings.baseCurrency : '%'; + this.unit = this.showDetails + ? (this.user.settings.baseCurrency ?? DEFAULT_CURRENCY) + : '%'; this.impersonationStorageService .onChangeHasImpersonation() @@ -122,17 +125,18 @@ export class GfHomeOverviewComponent implements OnInit { }) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(({ chart, errors, performance }) => { - this.errors = errors; + this.errors = errors ?? []; this.performance = performance; - this.historicalDataItems = chart.map( - ({ date, netPerformanceInPercentageWithCurrencyEffect }) => { - return { - date, - value: netPerformanceInPercentageWithCurrencyEffect * 100 - }; - } - ); + this.historicalDataItems = + chart?.map( + ({ date, netPerformanceInPercentageWithCurrencyEffect }) => { + return { + date, + value: (netPerformanceInPercentageWithCurrencyEffect ?? 0) * 100 + }; + } + ) ?? null; if ( this.deviceType === 'mobile' &&