From ac279a672dfc68b247768178a8db4d9885543612 Mon Sep 17 00:00:00 2001 From: Cosmo Date: Thu, 16 Apr 2026 09:02:07 +0000 Subject: [PATCH] fix: add SessionProvider to fix useSession SSR crash --- next.config.js | 3 +++ src/app/(dashboard)/layout.tsx | 2 ++ src/app/layout.tsx | 5 ++++- src/app/providers.tsx | 6 ++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/app/providers.tsx diff --git a/next.config.js b/next.config.js index d58690c..4082a5d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,9 @@ /** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', + experimental: { + missingSuspenseWithCSRBailout: false, + }, images: { remotePatterns: [ { protocol: 'https', hostname: '**' }, diff --git a/src/app/(dashboard)/layout.tsx b/src/app/(dashboard)/layout.tsx index 9b025c0..0950324 100644 --- a/src/app/(dashboard)/layout.tsx +++ b/src/app/(dashboard)/layout.tsx @@ -1,5 +1,7 @@ import { Sidebar } from "@/components/layout/Sidebar"; +export const dynamic = "force-dynamic"; + export default function DashboardLayout({ children }: { children: React.ReactNode }) { return (
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2f83bf6..fe0a35e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata } from "next"; import "./globals.css"; +import { Providers } from "./providers"; export const metadata: Metadata = { title: "Digital Home", @@ -16,7 +17,9 @@ export default function RootLayout({ }>) { return ( - {children} + + {children} + ); } diff --git a/src/app/providers.tsx b/src/app/providers.tsx new file mode 100644 index 0000000..e294e82 --- /dev/null +++ b/src/app/providers.tsx @@ -0,0 +1,6 @@ +"use client"; +import { SessionProvider } from "next-auth/react"; + +export function Providers({ children }: { children: React.ReactNode }) { + return {children}; +}