-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScaleTelekomFooter throws hydration error #1773
Comments
Thanks for reporting once more @rbcm1 We've been able to reproduce it in a Next.js project. We assume there's something in the markup of the new Footer causing this kind of error. We'll try and find what it is pretty soon. |
i found this sample implementation from the next docs https://github.com/vercel/next.js/blob/canary/examples/with-stencil/packages/web-app/pages/_app.js, and I was able to get rid of all errors by defining the custom elements in _app.js like this:
would this solution work for you @rbcm1 ? |
Hi @felix-ico, just did a quick test on my side and this seems to work. |
Hi @felix-ico, didn't notice this on the log file: Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes. So, it seems like this workaround is not really ideal. But again: let me check with one my team members and I will let you know. |
According to this comment pointing to facebook/react#26395, the warning is being removed from React. I agree the solution is probably not ideal, but maybe it's not that bad either. We're looking forward to the feedback from the team. |
For now we will go ahead and use the workaround suggested. |
The component throws an hydration error (here using React wrapper, but issue also happens with the plain HTML component):
<ScaleTelekomFooter> <ScaleTelekomFooterContent> <span slot="notice">{new Date().getFullYear()} © Deutsche Telekom AG </span> </ScaleTelekomFooterContent> </ScaleTelekomFooter>
Using with React 18.2.0 and beta.131. Package.json:
{ "name": "berec-vas-pws-webapp", "version": "1.0.0", "private": true, "dependencies": { "@telekom/scale-components": "^3.0.0-beta.131", "@telekom/scale-components-react": "^3.0.0-beta.131", "eslint": "8.37.0", "eslint-config-next": "13.2.4", "next": "^13.3.0", "react": "18.2.0", "react-dom": "18.2.0" }, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" } }
The text was updated successfully, but these errors were encountered: