From 89167d12ffda3bbb4834cdb83b79d2cf9401cc8e Mon Sep 17 00:00:00 2001 From: mister-ideas <36502095+mister-ideas@users.noreply.github.com> Date: Mon, 19 Oct 2026 18:52:10 +0200 Subject: [PATCH] Feature/skip the counting animation of the portfolio value on a background refresh --- .../portfolio-performance.component.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts index 4f772e4993..3cc43a3927 100644 --- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts +++ b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts @@ -107,8 +107,9 @@ export class GfPortfolioPerformanceComponent { } /** - * Counts up from zero on the initial value and rolls from the current to - * the new number on a refresh. Nothing happens if the number is unchanged. + * Counts up from zero on the initial load and after a reload (e.g. a changed + * date range). A background refresh swaps the number without any counting + * animation. Nothing happens if the number is unchanged. */ private showValue({ decimalPlaces, @@ -121,17 +122,20 @@ export class GfPortfolioPerformanceComponent { return; } - const isUpdate = this.countUpTarget !== undefined; + const isRefresh = this.countUpTarget !== undefined; this.countUp = new CountUp('value', value, { decimalPlaces, decimal: getNumberFormatDecimal(this.locale()), - duration: isUpdate ? 0.6 : 1, - separator: getNumberFormatGroup(this.locale()), - startVal: isUpdate ? this.countUpTarget : 0 + duration: 1, + separator: getNumberFormatGroup(this.locale()) }); - this.countUp.start(); + if (isRefresh) { + this.value().nativeElement.textContent = this.countUp.formatNumber(value); + } else { + this.countUp.start(); + } this.countUpTarget = value; }