Skip to content

Commit

Permalink
chore(vercel): theme cache test
Browse files Browse the repository at this point in the history
  • Loading branch information
mydearxym committed Mar 6, 2024
1 parent 71d2595 commit 3bfc86b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<html lang="en">
<body>
<GraphQLProvider token={token}>
<RootStoreProvider token={token}>
<RootStoreProvider token={token} theme={theme}>
<StyledComponentsRegistry>
<GlobalLayout>{children}</GlobalLayout>
</StyledComponentsRegistry>
Expand Down
8 changes: 7 additions & 1 deletion src/app/providers/RootStoreProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,10 +28,11 @@ enableStaticRendering(typeof window === 'undefined')

type TProps = {
token: null | string
theme: TThemeName
children: ReactNode
}

const RootStoreWrapper: FC<TProps> = ({ children, token }) => {
const RootStoreWrapper: FC<TProps> = ({ children, token, theme }) => {
const userHasLogin = !!token

const metric = useMetric()
Expand Down Expand Up @@ -72,6 +74,10 @@ const RootStoreWrapper: FC<TProps> = ({ children, token }) => {
},
wallpaperEditor: wallpaper,
dashboardThread: dashboard,

theme: {
curTheme: theme,
},
})

return <Provider store={store}>{children}</Provider>
Expand Down

0 comments on commit 3bfc86b

Please sign in to comment.