fix: byte formatting + exactOptionalPropertyTypes

fmtBytes used 1<<40 — a 32-bit shift in JS evaluates to 1<<8=256, so every
value >=256 bytes rendered as TB. Also drop undefined-valued props that
exactOptionalPropertyTypes rejects in incident/status-page bodies.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomas DvorakandDevin committed 2026-09-21 19:38:19 +02:00
1 parent c84a4be876
commit 97b8f5e87f
4 files changed
+16 -6

No files matched your search

+7 -2
View File
@@ -54,7 +54,9 @@ export function IncidentsPage() {
// The select only offers the three severities, but its value is a
// plain string — narrow at the boundary instead of asserting.
const severity = sev === "critical" || sev === "minor" ? sev : "major";
await api.POST("/api/incidents", { body: { title: title.trim(), severity, message: msg || undefined } });
await api.POST("/api/incidents", {
body: { title: title.trim(), severity, ...(msg.trim() ? { message: msg.trim() } : {}) },
});
setBusy(false);
setDlgOpen(false);
setTitle(""); setMsg("");
@@ -63,7 +65,10 @@ export function IncidentsPage() {
async function transition(id: string | undefined, to: Status, message?: string) {
if (!id) return;
await api.PATCH("/api/incidents/{id}", { params: { path: { id } }, body: { status: to, message } });
await api.PATCH("/api/incidents/{id}", {
params: { path: { id } },
body: { status: to, ...(message?.trim() ? { message } : {}) },
});
await load();
}