diff --git a/apps/dashboard/src/app/(dashboard)/incidents/[id]/page.tsx b/apps/dashboard/src/app/(dashboard)/incidents/[id]/page.tsx
index 8c4ec5c0..5566255c 100644
--- a/apps/dashboard/src/app/(dashboard)/incidents/[id]/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/incidents/[id]/page.tsx
@@ -1,5 +1,7 @@
import { notFound } from "next/navigation";
+import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";
+
import { Client } from "./client";
export default async function Page({
@@ -10,5 +12,26 @@ export default async function Page({
const { id } = await params;
const incidentId = Number(id);
if (!Number.isInteger(incidentId)) return notFound();
- return ;
+
+ const queryClient = getQueryClient();
+ // Throws FORBIDDEN without the feature / NOT_FOUND for a foreign id;
+ // prefetchQuery swallows both and the client renders the empty state.
+ await Promise.all([
+ queryClient.prefetchQuery(
+ trpc.incident.get.queryOptions({ id: incidentId }),
+ ),
+ queryClient.prefetchQuery(
+ trpc.incident.listEvents.queryOptions({ id: incidentId }),
+ ),
+ queryClient.prefetchQuery(trpc.member.list.queryOptions()),
+ queryClient.prefetchQuery(
+ trpc.statusReport.list.queryOptions({ order: "desc" }),
+ ),
+ ]);
+
+ return (
+
+
+
+ );
}
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/constants.ts b/apps/dashboard/src/app/(dashboard)/monitors/[id]/constants.ts
index 0cd92788..c4ed02b5 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/constants.ts
+++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/constants.ts
@@ -8,6 +8,6 @@ export const MONITOR_TABS: {
}[] = [
{ value: "overview", label: "Overview", icon: Overview },
{ value: "logs", label: "Logs", icon: Logs },
- { value: "incidents", label: "Incidents", icon: Incident },
+ { value: "incidents", label: "Downtime", icon: Incident },
{ value: "edit", label: "Settings", icon: Settings },
];
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
index d623f156..adae79f4 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
@@ -3,6 +3,7 @@
import { Info } from "@openstatus/icons";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
+import { useMemo } from "react";
import { Link } from "@/components/common/link";
import { Note } from "@/components/common/note";
@@ -18,9 +19,10 @@ import {
SectionHeader,
SectionTitle,
} from "@/components/content/section";
-import { columns } from "@/components/data-table/incidents/columns";
+import { getColumns } from "@/components/data-table/incidents/columns";
import { DataTable } from "@/components/ui/data-table/data-table";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
+import { useFeature } from "@/hooks/use-feature";
import { useTRPC } from "@/lib/trpc/client";
export default function Page() {
@@ -34,6 +36,11 @@ export default function Page() {
const { data: monitor } = useQuery(
trpc.monitor.get.queryOptions({ id: Number.parseInt(id) }),
);
+ const incidentsEnabled = useFeature("incident-management");
+ const columns = useMemo(
+ () => getColumns({ declare: incidentsEnabled }),
+ [incidentsEnabled],
+ );
if (!incidents || !monitor) return null;
@@ -42,8 +49,8 @@ export default function Page() {
- Incidents are automatically created when a monitor detects downtime.
- To communicate updates to your users, use Status Reports on a{" "}
+ Downtime is recorded automatically when a monitor fails. To tell your
+ users, use Status Reports on a{" "}
Status Page.