Skip to content
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

Hydration failed for server rendered code #271

Closed
pekarja5 opened this issue Aug 22, 2022 · 3 comments · Fixed by #272
Closed

Hydration failed for server rendered code #271

pekarja5 opened this issue Aug 22, 2022 · 3 comments · Fixed by #272

Comments

@pekarja5
Copy link
Contributor

Description

Hydration fails with:
Prop `style` did not match. Server: "position:absolute;left:0;right:0" Client: "position:absolute;will-change:;left:0;right:0"

Server is running Next.js 12.0.5 with React 18 on Node 16 LTS.

The problem is caused by different style resolve for empty strings (server won't include them, but client does) resulting in hydration fail.
Using undefined instead of empty strings should unify the results (key should not be present on both - client and sever).

Operations like this are causing the issue: https://github.com/zillow/react-slider/blob/master/src/components/ReactSlider/ReactSlider.jsx#L977

@kris-ellery
Copy link
Member

Thanks for submitting an issue @pekarja5!

styled-components are known to have SSR issues with 3rd party libs. Material UI team has to deal with it all the time. Feel free to open PR if it's something you would like to address before we're able to get to it. Thanks!

@pekarja5
Copy link
Contributor Author

@kris-ellery Any chance to have #272 merged to fix the issue?

@kris-ellery
Copy link
Member

@pekarja5 thank you for contributing! Released in 2.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants