refactor: move ROUTES from @/lib/routes to @/router/routes

This commit is contained in:
2026-06-10 10:53:43 +08:00
parent a4b902893e
commit 2cba315214
15 changed files with 45 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
"use client";
/**
* SessionProvider 客户端包装
*
* 背景:next-auth v4 的 `SessionProvider`(从 `next-auth/react` 导出)
* **没有** `"use client"` 指令。这是 v4 的历史遗留(v5 / Auth.js 已修正)。
*
* 当 Server Component(如 `src/app/layout.tsx`)直接 import 时,Next.js
* 不会自动把它当 client component 渲染,会继续在服务端 tree 里执行,导致
* `useContext` / `useState` 报错:
* "Error: React Context is unavailable in Server Components"
*
* 修复:新建一个显式 `"use client"` 的 wrapperre-export `SessionProvider`。
* 这样 Server Component 看到的入口是 `"use client"`,会触发 RSC 边界。
*/
export { SessionProvider } from "next-auth/react";