Skip to content

Commit 103c3e3

Browse files
authored
🐛 fix: fix theme flicking (lobehub#6926)
1 parent 210920f commit 103c3e3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/layout/GlobalProvider/AppTheme.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ import Link from 'next/link';
1414
import { ReactNode, memo, useEffect } from 'react';
1515

1616
import AntdStaticMethods from '@/components/AntdStaticMethods';
17-
import { LOBE_THEME_NEUTRAL_COLOR, LOBE_THEME_PRIMARY_COLOR } from '@/const/theme';
17+
import {
18+
LOBE_THEME_APPEARANCE,
19+
LOBE_THEME_NEUTRAL_COLOR,
20+
LOBE_THEME_PRIMARY_COLOR,
21+
} from '@/const/theme';
1822
import { useGlobalStore } from '@/store/global';
1923
import { systemStatusSelectors } from '@/store/global/selectors';
2024
import { useUserStore } from '@/store/user';
@@ -125,6 +129,11 @@ const AppTheme = memo<AppThemeProps>(
125129
primaryColor: primaryColor ?? defaultPrimaryColor,
126130
}}
127131
defaultAppearance={defaultAppearance}
132+
onAppearanceChange={(appearance) => {
133+
if (themeMode !== 'auto') return;
134+
135+
setCookie(LOBE_THEME_APPEARANCE, appearance);
136+
}}
128137
theme={{
129138
cssVar: true,
130139
token: {

0 commit comments

Comments
 (0)