-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
Bug: suppressHydrationWarning
is not taken into account in production builds in React 18
#24270
Comments
If you removed both of these Have you checked whether this works? <tr>
<td suppressHydrationWarning={true}>{messages.format('rowLocalizedWithAsPath')}</td>
<td suppressHydrationWarning={true}>{asPath}</td>
</tr> ? |
I'm not able to follow this step. First it says I have no |
Ideally it would be nice to get a minimal repro too, that doesn't involve a whole project repository. |
suppressHydrationWarning
trigger errors on React 18 buildssuppressHydrationWarning
is not taken into account in production builds in React 18
OK, I got the project running. This is a bug in React. |
This will be fixed by #24271. Thanks for reporting! |
Thanks @gaearon - sorry I didn't have a chance to provide a simpler repo to reproduce this! |
Fix out in 18.1.0. |
Hi, |
Another interesting issue (but I'm not sure if it is related) is that when you have multiple elements that have hydration mismatches but are ignored / suppressed it is enough for one of them to be not suppressed to make them all fail hydration. Here you will see that each of the In the development build I'm only seeing this once. |
This error still occurs in 18.2.0 |
@gaearon can we reopen this issue? Seems a lot of people including myself are facing issues in 18.2.0 |
The hydration warning you're seeing is most likely related to the use of I believe using |
React version: 18
Steps To Reproduce
Link to code example:
https://github.com/Avansai/next-multilingual
The current behavior
Using React 18, the tests are failing because of the errors being thrown in the console.
I confirmed this was related to
suppressHydrationWarning
because as soon as I removed the following code from: https://github.com/Avansai/next-multilingual/blob/main/example/pages/tests/dynamic-routes/%5Bid%5D.tsx#L37The errors stop. However, I could not find any mention that
suppressHydrationWarning
was no longer supported with React 18 and these errors are only triggered on builds, not in dev mode (which is why I am opening this issue)The expected behavior
suppressHydrationWarning
should prevent these errors from being thrown.The text was updated successfully, but these errors were encountered: