Open doublelam opened 1 year ago
@doublelam At a glance, you may be missing CacheProvider
on both the server side and client side, see this doc: https://mui.com/material-ui/guides/server-rendering/#the-client-side
You're using React 18's renderToPipeableStream
, which is currently unsupported by both of Material UI's main styling engines, Emotion and styled-components.
The threads about this can be found here and here.
AFAICT, there is no way to use Material UI with React 18 streaming rendering, other than some hacks that have been pasted into various GitHub comments.
I'm not sure why there isn't a mention of this in the Material UI docs, or even a dedicated issue for it. Am I missing a way to make this work?
@thomasjm they're working on mui/zero, and apparently will have an alpha version out in november.
https://github.com/mui/material-ui/issues/38137 See mui/zero references: https://github.com/mui/material-ui/releases
Did you ever manage to solve this? I'm facing the same issue with a Hydrogen project
Duplicates
Latest version
Steps to reproduce 🕹
Hi, I am encountering the style-missing issue on client side, but the server-rendered correctly, no idea why it happend. Many thanks for your help!
My
server.js
:My client scripts:
index.tsx
:shell.tsx
:app-router.tsx
:home.tsx
:I have no idea why the server side rendered correctly but the local client miss the styles when js loaded
Current behavior 😯
client side is missing the MUI styles
Expected behavior 🤔
client should render same as server
Context 🔦
No response
Your environment 🌎
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ``` System: OS: macOS 12.6.3 Binaries: Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node Yarn: 1.9.2 - ~/.yvm/shim/yarn npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm Browsers: Chrome: 111.0.5563.64 Edge: Not Found Firefox: 107.0.1 Safari: 16.3 npmPackages: @emotion/react: 11.10.6 @emotion/styled: 11.10.6 @mui/base: 5.0.0-alpha.121 @mui/core-downloads-tracker: 5.11.13 @mui/joy: 5.0.0-alpha.71 @mui/private-theming: 5.11.13 @mui/styled-engine: 5.11.11 @mui/system: 5.11.13 @mui/types: 7.2.3 @mui/utils: 5.11.13 @types/react: 18.0.28 react: 18.2.0 react-dom: 18.2.0 typescript: 4.9.5npx @mui/envinfo