Skip to content

Commit ed63447

Browse files
only21milclaude
andcommitted
fix(web): Diagnostics memory no longer reads "1024.0 MB"
Settings > Diagnostics had its own formatBytes that picked the unit before rounding, so a process just under 1 GiB showed "1024.0 MB". Use the shared helper fixed in #26067, which the Resource Telemetry section on the same page already uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 15fe283 commit ed63447

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

‎apps/web/src/components/settings/DiagnosticsSettings.tsx‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
import * as DateTime from "effect/DateTime";
2121
import * as Option from "effect/Option";
2222

23+
import { formatBytes } from "../../lib/formatBytes";
2324
import { cn } from "../../lib/utils";
2425
import { ensureLocalApi } from "../../localApi";
2526
import { useOpenInPreferredEditor } from "../../editorPreferences";
@@ -51,18 +52,6 @@ function formatDuration(value: number): string {
5152
return `${(value / 1_000).toFixed(value >= 10_000 ? 1 : 2).replace(/\.0+$/, "")} s`;
5253
}
5354

54-
function formatBytes(value: number): string {
55-
if (value < 1024) return `${value} B`;
56-
const units = ["KB", "MB", "GB"] as const;
57-
let unitIndex = -1;
58-
let next = value;
59-
do {
60-
next /= 1024;
61-
unitIndex += 1;
62-
} while (next >= 1024 && unitIndex < units.length - 1);
63-
return `${next.toFixed(next >= 10 ? 1 : 2)} ${units[unitIndex]}`;
64-
}
65-
6655
function RelativeTimeNoWrap(props: { value: DateTime.Utc }) {
6756
const relative = useRelativeTimeState(DateTime.formatIso(props.value));
6857
if (relative.status !== "relative") return null;

0 commit comments

Comments
 (0)