Openstatus www.openstatus.dev

fix: incidents prefetch (#1741)

authored by

Maximilian Kaske and committed by
GitHub
e04c855d b273f41d

+14 -1
+14 -1
apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/layout.tsx
··· 1 import { SidebarProvider } from "@/components/ui/sidebar"; 2 import { Sidebar } from "../sidebar"; 3 4 - export default function Layout({ children }: { children: React.ReactNode }) { 5 return ( 6 <SidebarProvider defaultOpen={false}> 7 <div className="w-full flex-1">{children}</div>
··· 1 import { SidebarProvider } from "@/components/ui/sidebar"; 2 + import { getQueryClient, trpc } from "@/lib/trpc/server"; 3 import { Sidebar } from "../sidebar"; 4 5 + export default async function Layout({ 6 + children, 7 + params, 8 + }: { 9 + children: React.ReactNode; 10 + params: Promise<{ id: string }>; 11 + }) { 12 + const queryClient = getQueryClient(); 13 + const { id } = await params; 14 + await queryClient.prefetchQuery( 15 + trpc.incident.list.queryOptions({ monitorId: Number.parseInt(id) }), 16 + ); 17 + 18 return ( 19 <SidebarProvider defaultOpen={false}> 20 <div className="w-full flex-1">{children}</div>