ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🐛[BUG]在SSR的场景下,ProLayout报错`style` did not match #8622

Open ideaviewes opened 3 months ago

ideaviewes commented 3 months ago

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

在使用Nextjs14.14 中使用ProLayout,会报错style did not match和Hydration failed because the initial UI does not match what was rendered on the server. 如果这部分确实需要SSR的话,应该如何处理呢?

📷 复现步骤

在nextjs14的版本中使用ProLayout 100%的复现。

🏞 期望结果

不要有这种报错

💻 复现代码

https://github.com/ideaviewes/pro-layout-test.git

© 版本信息

image image
Snuffel233 commented 2 months ago

有同样的疑问,请问您解决了吗

ideaviewes commented 2 months ago

@Snuffel233 ,没,我先这样处理了,这部分不ssr

const ProLayout = dynamic(() => import("@ant-design/pro-components").then(mod => mod.ProLayout), {
    ssr: false,
});
Snuffel233 commented 2 months ago

收到