[PULSE-47] Add uptime monitoring dashboard #15
@@ -252,7 +252,10 @@ function UptimeStatusBar({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div
|
||||||
|
className="relative"
|
||||||
|
onMouseLeave={() => setHoveredDay(null)}
|
||||||
|
>
|
||||||
<div className="flex items-center gap-[2px] w-full">
|
<div className="flex items-center gap-[2px] w-full">
|
||||||
{dateRange.map((date) => {
|
{dateRange.map((date) => {
|
||||||
const stat = statsMap.get(date)
|
const stat = statsMap.get(date)
|
||||||
@@ -704,7 +707,7 @@ export default function UptimePage() {
|
|||||||
if (loading) return <LoadingOverlay logoSrc="/pulse_icon_no_margins.png" title="Uptime" />
|
if (loading) return <LoadingOverlay logoSrc="/pulse_icon_no_margins.png" title="Uptime" />
|
||||||
if (!site) return <div className="p-8 text-neutral-500">Site not found</div>
|
if (!site) return <div className="p-8 text-neutral-500">Site not found</div>
|
||||||
|
|
||||||
|
|
|||||||
const monitors = uptimeData?.monitors ?? []
|
const monitors = Array.isArray(uptimeData?.monitors) ? uptimeData.monitors : []
|
||||||
const overallUptime = uptimeData?.overall_uptime ?? 100
|
const overallUptime = uptimeData?.overall_uptime ?? 100
|
||||||
const overallStatus = uptimeData?.status ?? 'operational'
|
const overallStatus = uptimeData?.status ?? 'operational'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user
monitorscan benullUptimeStatusResponse.monitorsis typed asMonitorStatus[] | null(lib/api/uptime.ts), but this page still doesconst monitors = uptimeData?.monitors ?? []. If the API returnsmonitors: null, this expression evaluates tonull(because the optional chain returnsnull, which??does not replace), and the subsequentmonitors.length/monitors.map(...)will throw during render. Use an explicit array guard (e.g.,Array.isArray(uptimeData?.monitors) ? uptimeData.monitors : []) before reading.length/.map.Prompt To Fix With AI
alreayd fixed