diff --git a/example/.dumirc.ts b/example/.dumirc.ts index e8d5f23..9a59155 100644 --- a/example/.dumirc.ts +++ b/example/.dumirc.ts @@ -102,12 +102,9 @@ export default defineConfig({ { id: 'en-US', name: 'English', suffix: '-en' }, ], mfsu: isWin ? undefined : {}, + hash: true, npmClient: 'pnpm', - exportStatic: { - // 忽略预渲染失败的错误 - ignorePreRenderError: true, - }, - ...(isProduction ? { ssr: { builder: 'webpack' } } : {}), + ...(isProduction ? { ssr: {} } : {}), ...(isPreview ? { devtool: 'source-map' } : {}), styles: [ `html, body { background: transparent; } diff --git a/src/layouts/DocLayout/DocumentLayout.tsx b/src/layouts/DocLayout/DocumentLayout.tsx index 4d38de5..43b2ebe 100644 --- a/src/layouts/DocLayout/DocumentLayout.tsx +++ b/src/layouts/DocLayout/DocumentLayout.tsx @@ -58,7 +58,7 @@ const DocumentLayout = memo(() => { const shouldHideToc = fm.toc === false || noToc; const hideToc = mobile ? shouldHideToc : !laptop || shouldHideToc; - const HelmetBlock = useCallback(() => { + const getHelmetBlock = useCallback(() => { const title = customConfig?.title || fm.title; const description = customConfig?.description || fm.description || themeConfig.description; const keywords = customConfig?.keywords || fm.keywords || themeConfig.keywords; @@ -124,7 +124,7 @@ const DocumentLayout = memo(() => { ) { return ( <> - + {getHelmetBlock()} {clientRender && outlet} ); @@ -132,7 +132,7 @@ const DocumentLayout = memo(() => { return ( <> - + {getHelmetBlock()} {clientRender && ( { // Demo page should not contain App component if (!demoPage) { - content = {outlet}; + content = ( + + {/** + * @Todo 更新到 React 19 后,可移除这部分代码 + * This removes anything added to html from extensions, causing hydration issue + https://github.com/remix-run/remix/issues/4822 + https://github.com/facebook/react/issues/24430 + */} +