Openstatus www.openstatus.dev

fix: badge when undefined (#501)

authored by

Maximilian Kaske and committed by
GitHub
704a7d3f b33103a3

+6 -3
+3 -2
apps/web/src/app/app/(dashboard)/[workspaceSlug]/monitors/page.tsx
··· 30 30 monitorId, 31 31 limit: 1, 32 32 }); 33 - const lastStatusCode = ping && ping.length > 0 ? ping[0].statusCode : 0; 33 + const lastStatusCode = 34 + ping && ping.length > 0 ? ping[0].statusCode : undefined; 34 35 return lastStatusCode; 35 36 } 36 37 ··· 40 41 getMonitorLastStatusCode(String(monitor.id)), 41 42 ) || [], 42 43 ) 43 - ).map((code) => (code.status === "fulfilled" && code.value) || 0); 44 + ).map((code) => (code.status === "fulfilled" ? code.value : undefined)); 44 45 45 46 return ( 46 47 <div className="grid min-h-full grid-cols-1 grid-rows-[auto,1fr,auto] gap-6 md:grid-cols-2 md:gap-8">
+3 -1
apps/web/src/components/data-table/monitor/columns.tsx
··· 10 10 import { DataTableStatusBadge } from "../data-table-status-badge"; 11 11 import { DataTableRowActions } from "./data-table-row-actions"; 12 12 13 - export const columns: ColumnDef<Monitor & { lastStatusCode?: number }>[] = [ 13 + export const columns: ColumnDef< 14 + Monitor & { lastStatusCode?: number | null } 15 + >[] = [ 14 16 { 15 17 accessorKey: "name", 16 18 header: "Name",