-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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: SSR: "Text content did not match" for inline CSS in style element #26946
Comments
@EmielM Remove the quotes. They are unnecessary
|
@Shurtu-gal this is a synthetic/simplified example, there are cases when you really need a quote in your css, eg for |
I think it is a problem on hydration on CSR. Although this is my first issue, I would like to have a try. Do you mind to assign it to me? Thank you :3 I will update immediately once I feel not okay to solve it. |
@YantD729 We're still having this, would you mind :)? |
I have encountered this issue as well. function App() {
return <html>
<head>
<style dangerouslySetInnerHTML={{ __html: "body { font-family: "Comic Sans"; }" }}></style>
</head>
</html>;
} HTML output: <!DOCTYPE html><html><head><style>body { font-family: "Comic Sans"; }</style></head><body>Body!</body></html><script src="/bundle.js" async=""></script> |
I'm having the same issue when rendering with Same thing happens with inline scripts and characters like |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Still an issue |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
When using Server Side Rendering for the complete document (as suggested in the docs), and having inline css that contains quotes (
"
,'
) in a style element:The quotes are encoded by
react-dom/server
as"
, and client-side hydration chokes:React version: 18.2.0
Reproducing case: https://github.com/EmielM/react-ssr-reconcile-repro
For completeness, the verbatim HTML output from the server:
The text was updated successfully, but these errors were encountered: