Skip to content

Commit

Permalink
optimize(code): optimize the experience
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeng889 committed Aug 14, 2024
1 parent c6ea8b0 commit 6a1354a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ConfigProvider } from 'antd';
import { useUpdateEffect } from 'ahooks';
import { localStg } from '@/utils/storage';
import { getLocale } from '@/store/slice/app';
import { getAntdTheme, setupThemeVarsToHtml, toggleCssDarkMode } from '@/store/slice/theme/shared.ts';
Expand All @@ -18,8 +19,11 @@ const App = () => {
useEffect(() => {
setupThemeVarsToHtml(colors);
localStg.set('themeColor', colors.primary);
}, [colors]);

useUpdateEffect(() => {
toggleCssDarkMode(darkMode);
}, [colors, darkMode]);
}, [darkMode]);

return (
<ConfigProvider
Expand Down
2 changes: 1 addition & 1 deletion src/router/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export const afterEach: AfterEach = to => {
const { i18nKey, title } = to.meta;

const documentTitle = i18nKey ? $t(i18nKey) : title;
document.title = documentTitle;
document.title = documentTitle ?? 'React-Soybean';
window.NProgress?.done?.();
};

0 comments on commit 6a1354a

Please sign in to comment.