From d00b78f3383563c1eb8761d6ad17cdbcbdaad8fc Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 3 Mar 2026 03:32:06 +0000 Subject: [PATCH] fix: apply formatTokenAmount to Total row and guard against NaN/Infinity Co-Authored-By: Claude Sonnet 4.6 --- kraiken-lib/src/format.ts | 1 + web-app/src/components/collapse/CollapseActive.vue | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/kraiken-lib/src/format.ts b/kraiken-lib/src/format.ts index efc55fe..06d906d 100644 --- a/kraiken-lib/src/format.ts +++ b/kraiken-lib/src/format.ts @@ -27,5 +27,6 @@ export function commaNumber(value: number): string { /** Format a token amount with comma grouping and 2 decimal places (e.g. "1,234.56") */ export function formatTokenAmount(value: number): string { + if (!isFinite(value)) return '0.00'; return value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); } diff --git a/web-app/src/components/collapse/CollapseActive.vue b/web-app/src/components/collapse/CollapseActive.vue index b748ce4..8955831 100644 --- a/web-app/src/components/collapse/CollapseActive.vue +++ b/web-app/src/components/collapse/CollapseActive.vue @@ -50,7 +50,7 @@
Total
-
{{ taxPaidGes !== undefined && profit !== undefined ? total.toFixed(5) : '...' }} $KRK
+
{{ taxPaidGes !== undefined && profit !== undefined ? formatTokenAmount(total) : '...' }} $KRK