Skip to content

Commit

Permalink
fix: div is render to outsite of html tag when SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
Carrotzpc committed Aug 19, 2024
1 parent b5551a2 commit 4f62f74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const SSRPlugin = (api: IApi) => {
const cssFile = writeCSSFile(result!.key, result!.ids.join(''), result!.css);

file.content = addLinkStyle(file.content, cssFile);
// @Todo: move '</body></html>' to the end for workaround
file.content = file.content.replace('</body></html>', '') + '</body></html>';
}

return file;
Expand Down
18 changes: 10 additions & 8 deletions src/slots/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Footer as Foot, FooterProps } from '@lobehub/ui';
import { Divider } from 'antd';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { memo, useMemo } from 'react';
import { Center, Flexbox } from 'react-layout-kit';
import { shallow } from 'zustand/shallow';

Expand All @@ -18,15 +18,17 @@ const Footer = memo(() => {
const { mobile } = useResponsive();
const { styles, theme } = useStyles();

if (!footer) return;

const columns = footerConfig?.columns
? footerConfig?.columns
: getColumns({ github: githubUrl || (pkg as any).homepage });
const columns = useMemo(() => {
const cs = footerConfig?.columns
? footerConfig?.columns
: getColumns({ github: githubUrl || (pkg as any).homepage });
if (footerConfig?.resources) cs[0] = footerConfig?.resources;
if (footerConfig?.moreProducts) cs[3] = footerConfig?.moreProducts;

if (footerConfig?.resources) columns[0] = footerConfig?.resources;
if (footerConfig?.moreProducts) columns[3] = footerConfig?.moreProducts;
return cs.filter(c => c.items && c.items.length > 0);
}, [footerConfig?.columns, footerConfig?.moreProducts, footerConfig?.resources, githubUrl, pkg]);

if (!footer) return;
const bottomFooter = footerConfig?.bottom || footer;

return (
Expand Down

0 comments on commit 4f62f74

Please sign in to comment.