优化用户数据初始化时机

This commit is contained in:
2025-11-18 19:16:24 +08:00
parent 5b1dae6e6c
commit fa6a4e5121
19 changed files with 52 additions and 52 deletions

View File

@@ -5,7 +5,6 @@ import './globals.css'
import localFont from 'next/font/local'
import {Toaster} from '@/components/ui/sonner'
import StoresProvider from '@/components/stores-provider'
import {getProfile} from '@/actions/auth'
import Effects from '@/app/effects'
const font = localFont({
@@ -23,16 +22,11 @@ export default async function RootLayout({
}: Readonly<{
children: ReactNode
}>) {
const result = await getProfile()
const user = result.success ? result.data : null
return (
<html lang="zh-CN">
<body className={`${font.className}`}>
<StoresProvider user={user}>
<Effects>
{children}
</Effects>
<StoresProvider>
<Effects>{children}</Effects>
</StoresProvider>
<Toaster position="top-center" richColors expand/>
</body>