Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(web): defer client-only detail views to fix hydration error #418
Beenu Arora2b5ffad5eaa1
diff --git a/apps/web/src/app/(app)/alerts/[id]/page.tsx b/apps/web/src/app/(app)/alerts/[id]/page.tsxindex 3cb6f65ec..35df7fcc9 100644--- a/apps/web/src/app/(app)/alerts/[id]/page.tsx+++ b/apps/web/src/app/(app)/alerts/[id]/page.tsx@@ -1,4 +1,6 @@import { AlertDetailView } from '@/components/alerts/AlertDetailView';+import { ClientOnly } from '@/components/util/ClientOnly';+import { SkeletonCard } from '@/components/ui/Skeleton';export const metadata = {title: 'Alert Detail | AiSOC',@@ -10,5 +12,16 @@ export default async function AlertDetailPage({params: Promise<{ id: string }>;}) {const { id } = await params;- return <AlertDetailView alertId={id} />;+ return (+ <ClientOnly+ fallback={+ <div className="space-y-4 p-6">+ <SkeletonCard />+ <SkeletonCard />+ </div>+ }+ >+ <AlertDetailView alertId={id} />+ </ClientOnly>+ );}diff --git a/apps/web/src/app/(app)/cases/[id]/page.tsx b/apps/web/src/app/(app)/cases/[id]/page.tsxindex 47ff3f990..640b7bc66 100644--- a/apps/web/src/app/(app)/cases/[id]/page.tsx+++ b/apps/web/src/app/(app)/cases/[id]/page.tsx@@ -1,4 +1,6 @@import { CaseWorkspace } from '@/components/cases/CaseWorkspace';+import { ClientOnly } from '@/components/util/ClientOnly';+import { SkeletonCard } from '@/components/ui/Skeleton';interface CasePageProps {params: Promise<{ id: string }>;@@ -10,5 +12,16 @@ export const metadata = {export default async function CaseDetailPage({ params }: CasePageProps) {const { id } = await params;- return <CaseWorkspace caseId={id} />;+ return (+ <ClientOnly+ fallback={+ <div className="space-y-4 p-6">+ <SkeletonCard />+ <SkeletonCard />+ </div>+ }+ >+ <CaseWorkspace caseId={id} />+ </ClientOnly>+ );}diff --git a/apps/web/src/app/(app)/detection/[id]/page.tsx b/apps/web/src/app/(app)/detection/[id]/page.tsxindex 99421b5bf..f2cfc065a 100644--- a/apps/web/src/app/(app)/detection/[id]/page.tsx+++ b/apps/web/src/app/(app)/detection/[id]/page.tsx@@ -1,4 +1,6 @@import { RuleEditor } from '@/components/detections/RuleEditor';+import { ClientOnly } from '@/components/util/ClientOnly';+import { SkeletonCard } from '@/components/ui/Skeleton';interface DetectionEditPageProps {params: Promise<{ id: string }>;@@ -12,5 +14,15 @@ export default async function DetectionEditPage({params,}: DetectionEditPageProps) {const { id } = await params;- return <RuleEditor mode="edit" ruleId={id} />;+ return (+ <ClientOnly+ fallback={+ <div className="space-y-4 p-6">+ <SkeletonCard />+ </div>+ }+ >+ <RuleEditor mode="edit" ruleId={id} />+ </ClientOnly>+ );}diff --git a/apps/web/src/app/(app)/playbooks/[id]/page.tsx b/apps/web/src/app/(app)/playbooks/[id]/page.tsxindex 46775d551..9ea5e0764 100644--- a/apps/web/src/app/(app)/playbooks/[id]/page.tsx+++ b/apps/web/src/app/(app)/playbooks/[id]/page.tsx@@ -1,4 +1,6 @@import { PlaybookEditor } from '@/components/playbooks/PlaybookEditor';+import { ClientOnly } from '@/components/util/ClientOnly';+import { SkeletonCard } from '@/components/ui/Skeleton';export const metadata = {title: 'Playbook Editor | AiSOC',@@ -12,7 +14,15 @@ export default async function PlaybookEditorPage({const { id } = await params;return (<div className="h-full">- <PlaybookEditor playbookId={id} />+ <ClientOnly+ fallback={+ <div className="space-y-4 p-6">+ <SkeletonCard />+ </div>+ }+ >+ <PlaybookEditor playbookId={id} />+ </ClientOnly></div>);}diff --git a/apps/web/src/components/util/ClientOnly.tsx b/apps/web/src/components/util/ClientOnly.tsxnew file mode 100644index 000000000..5874e62d9--- /dev/null+++ b/apps/web/src/components/util/ClientOnly.tsx@@ -0,0 +1,30 @@+'use client';++import { useEffect, useState, type ReactNode } from 'react';++interface ClientOnlyProps {+ children: ReactNode;+ fallback?: ReactNode;+}++/**+ * Renders children only after the component has mounted on the client.+ *+ * Use for subtrees that depend on browser-only values (localStorage, real-time+ * relative timestamps, window measurements). The server and the first client+ * paint both render `fallback`, so React hydration matches and we avoid+ * minified error #418/#421.+ */+export function ClientOnly({ children, fallback = null }: ClientOnlyProps) {+ const [mounted, setMounted] = useState(false);++ useEffect(() => {+ setMounted(true);+ }, []);++ if (!mounted) {+ return <>{fallback}</>;+ }++ return <>{children}</>;+}