Skip to content

Commit

Permalink
🐛 fix: Try to fix ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Nov 25, 2024
1 parent 61ce51b commit 3f3f148
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export { siteSelectors, type SiteStore, useSiteStore } from './store';
export * from './types';
export { styles } from '@/store/initialState';

const defineThemeConfig = (config: SiteThemeConfig) => config;
export const defineThemeConfig = (config: SiteThemeConfig) => config;

module.exports = { defineThemeConfig };
6 changes: 6 additions & 0 deletions src/layouts/DocLayout/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { ThemeProvider } from '@lobehub/ui';
import { extractStaticStyle } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { PropsWithChildren, memo } from 'react';

import GlobalStyle from '@/layouts/DocLayout/GlobalStyle';
import { siteSelectors, useSiteStore, useThemeStore } from '@/store';
import customToken from '@/styles/customToken';

//@ts-ignore
global.__ANTD_CACHE__ = extractStaticStyle.cache;

export default memo<PropsWithChildren>(({ children }) => {
const themeMode = useThemeStore((st) => st.themeMode);
const userToken = useSiteStore(siteSelectors.token, isEqual);

return (
<ThemeProvider
cache={extractStaticStyle.cache}
customToken={(themeToken) => Object.assign({}, customToken(themeToken), userToken)}
prefixCls={'site'}
themeMode={themeMode}
>
<GlobalStyle />
Expand Down
3 changes: 2 additions & 1 deletion src/slots/Hero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Hero as H } from '@lobehub/ui';
import { Link } from 'dumi';
import { memo } from 'react';

import { heroSelectors, useSiteStore } from '@/store';
Expand All @@ -10,7 +11,7 @@ const Hero = memo(() => {
heroSelectors.heroActions(s),
]);

return <H actions={actions} description={description} title={title!} />;
return <H Link={Link} actions={actions} description={description} title={title!} />;
});

export default Hero;

0 comments on commit 3f3f148

Please sign in to comment.