From 4b6cb5f11e879e09cfe7f328aabfdcff48fb064c Mon Sep 17 00:00:00 2001 From: SpecialX <47072643+wangxiner55@users.noreply.github.com> Date: Sat, 4 Jul 2026 10:23:43 +0800 Subject: [PATCH] feat(app): update dashboard layout and student learning error boundaries - Update src/app/layout.tsx - Update student/learning/study-path/error.tsx --- src/app/(dashboard)/student/learning/study-path/error.tsx | 5 ++--- src/app/layout.tsx | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/(dashboard)/student/learning/study-path/error.tsx b/src/app/(dashboard)/student/learning/study-path/error.tsx index 565a4a1..511340e 100644 --- a/src/app/(dashboard)/student/learning/study-path/error.tsx +++ b/src/app/(dashboard)/student/learning/study-path/error.tsx @@ -1,13 +1,12 @@ "use client" -import { RouteError } from "@/shared/components/route-error" +import { RouteErrorBoundary } from "@/shared/components/route-error" export default function StudentStudyPathError({ - error, reset, }: { error: Error & { digest?: string } reset: () => void }) { - return + return } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d89ba3c..b69852d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -7,6 +7,7 @@ import { ThemeProvider } from "@/shared/components/theme-provider"; import { Toaster } from "@/shared/components/ui/sonner"; import { NuqsAdapter } from "nuqs/adapters/next/app"; import { AuthSessionProvider } from "@/shared/components/auth-session-provider"; +import { auth } from "@/auth"; import "./globals.css"; const inter = Inter({ @@ -46,6 +47,10 @@ export default async function RootLayout({ const locale = await getLocale(); const messages = await getMessages(); + // v3: SSR 期间获取 session,传给 AuthSessionProvider, + // 避免 next-auth useSession 在 SSR/CSR 之间返回不同 status 导致 hydration mismatch。 + const session = await auth(); + return ( - + {children}