-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"Advanced approach" SSR with Next broken with react-dom
18
#2725
Comments
Emotion inserts styles differently in React 18 to be compatible with React's new SSR streaming capabilities. Could you explain what the expected behavior vs. actual behavior is for Emotion in the context of React 18? Ideally you would also provide a minimal reproducible example. BTW, I tried running your project on Windows but could not because of the Unix-specific scripts. |
Hi @srmagura thank you for your answer, As I am sure you know, MUI is using emotion. ReproduceI created a minimal repo to exhibit what is no longer working as it used to. Fist disable JavaScript git clone https://github.com/garronej/ssr-react-18-next
cd ssr-react-18-next
yarn
yarn build
yarn start
#heads over to http://localhost:3000 Now, if you downgrade to What's happeningYou can see this The red string tag is not generated with My 2 senceIf you run the app with Screen.Recording.2022-04-18.at.02.22.21.movIn the hope that a solution can be found, |
@garronej Thank you so much, that really clears it up. The "Advanced Approach" docs seem to be incomplete or incorrect for React 18 at the moment. Someone will need to do some testing with Next and MUI and either fix or add to that section in our docs. Apart from the aforementioned documentation issue, I don't see anything Emotion is doing that is "wrong". My current feeling is that MUI is not compatible with the new streaming SSR, and that that is the underlying issue. After reading the relevant code in Emotion (which is quite complex), I think Emotion will always insert Maybe we need to insert a toggle into Emotion to allow users to revert back to the React 17 behavior even when using React 18? I am thinking of this as a stopgap until MUI can fully support SSR streaming. A lot of the discussion on mui/material-ui#24109 is likely relevant to this. |
I've created a Next.js issue about this here. As a workaround you set |
The created issue was closed by this PR so I will assume that this should get fixed with the next Next release. |
Hi, |
looks like the problem arrived again in canary release. |
Hi @himadrinath, I just tested with the current canary version, However, there are other issues, see the warning of tss-react:
|
Hi,
Again, thank you for your work on Emotion, it's a fantastic library.
UPDATE: Scroll down to this message, it better describe the issue.
The text was updated successfully, but these errors were encountered: