@devries-cameron20 / t3code-1 / commits / 456892da72
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): show rounded diff counts as 1m instead of 1000k (#23723)

Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Victor Vogel committed Oct 29, 2026 at 12:41 UTC 456892da72abbf6cbe9140774a82265fe1329b7f
2 files changed +15 -3
apps/web/src/components/chat/DiffStatLabel.test.ts new
+12
@@ -0,0 +1,12 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { formatCompactDiffCount } from "./DiffStatLabel";
4 +
5 +describe("formatCompactDiffCount", () => {
6 + it("promotes counts when rounding reaches the next suffix", () => {
7 + expect(formatCompactDiffCount(999_499)).toBe("999k");
8 + expect(formatCompactDiffCount(999_500)).toBe("1m");
9 + expect(formatCompactDiffCount(999_499_999)).toBe("999m");
10 + expect(formatCompactDiffCount(999_500_000)).toBe("1b");
11 + });
12 +});
apps/web/src/components/chat/DiffStatLabel.tsx
+3 -3
@@ -5,13 +5,13 @@ export function hasNonZeroStat(stat: { additions: number; deletions: number }):
5 return stat.additions > 0 || stat.deletions > 0;
6 }
7
8 -function formatCompactDiffCount(value: number): string {
8 +export function formatCompactDiffCount(value: number): string {
9 if (value < 1000) return String(value);
10 - if (value < 1_000_000) {
10 + if (value < 999_500) {
11 const k = value / 1000;
12 return `${k < 10 ? k.toFixed(1).replace(/\.0$/, "") : Math.round(k)}k`;
13 }
14 - if (value < 1_000_000_000) {
14 + if (value < 999_500_000) {
15 const m = value / 1_000_000;
16 return `${m < 10 ? m.toFixed(1).replace(/\.0$/, "") : Math.round(m)}m`;
17 }