feat: add path navigation and shared settings transitions
This commit is contained in:
1 parent
caad17d195
commit
84c9e97451
25 files changed
+689
-151
No files matched your search
+4
-14
@@ -1,19 +1,9 @@
|
||||
// 主页:Server Component —— 从 cookie 读取缓存论坛名(SSR 首帧即输出),
|
||||
// 其余逻辑在客户端 HomeClient 中
|
||||
import { cookies } from 'next/headers';
|
||||
import HomeClient from './HomeClient';
|
||||
// 主页:Server Component,路径页面共用同一个客户端应用外壳。
|
||||
import ForumPage from './ForumPage';
|
||||
|
||||
// cookies() 是动态 API:禁止静态优化,每次请求 SSR
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function Home() {
|
||||
let cachedName = '';
|
||||
try {
|
||||
// Next 15+:cookies() 返回 Promise,必须 await
|
||||
const cookieStore = await cookies();
|
||||
cachedName = decodeURIComponent(cookieStore.get('forumlify-name')?.value || '');
|
||||
} catch (e) {
|
||||
cachedName = '';
|
||||
}
|
||||
return <HomeClient cachedName={cachedName} />;
|
||||
export default function Home() {
|
||||
return <ForumPage />;
|
||||
}
|
||||
Reference in new issue
Block a user