From 3bfc86b9a91a4fa8baa257425b401d0235cbd545 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 6 Mar 2024 15:07:37 +0800 Subject: [PATCH] chore(vercel): theme cache test --- src/app/layout.tsx | 3 ++- src/app/providers/RootStoreProvider.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 961cdd314..5d5d6b5ee 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -18,12 +18,13 @@ export const metadata: Metadata = { export default function Layout({ children }: { children: React.ReactNode }) { // const token = cookies().get('jwtToken')?.value || null const token = null + const theme = cookies().get('theme')?.value === 'night' ? 'night' : 'day' return ( - + {children} diff --git a/src/app/providers/RootStoreProvider.tsx b/src/app/providers/RootStoreProvider.tsx index 998cba365..402c24a60 100644 --- a/src/app/providers/RootStoreProvider.tsx +++ b/src/app/providers/RootStoreProvider.tsx @@ -4,6 +4,7 @@ import { FC, ReactNode } from 'react' import { Provider } from 'mobx-react' import { enableStaticRendering } from 'mobx-react-lite' +import type { TThemeName } from '@/spec' import { useStore } from '@/stores/init' import { @@ -27,10 +28,11 @@ enableStaticRendering(typeof window === 'undefined') type TProps = { token: null | string + theme: TThemeName children: ReactNode } -const RootStoreWrapper: FC = ({ children, token }) => { +const RootStoreWrapper: FC = ({ children, token, theme }) => { const userHasLogin = !!token const metric = useMetric() @@ -72,6 +74,10 @@ const RootStoreWrapper: FC = ({ children, token }) => { }, wallpaperEditor: wallpaper, dashboardThread: dashboard, + + theme: { + curTheme: theme, + }, }) return {children}