-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Server side rendering with Express - warning on the client checksum & Styling #4466
Comments
Is it good practice to go with this warning and fix it later or I should build the app with client side rendering and later make the server side rendering . . |
I've met this problem before and dealt with it for a long period. I don't use react-router so I've no idea this would help you. The solution is simple, just passing <MuiThemeProvider muiTheme={getMuiTheme({userAgent: navigator.userAgent)}>
<Provider store={store}>
...
</Provider>
</MuiThemeProvider> |
@OshotOkill Still the same warning. |
I had this problem, I was able to get around it by monkeypatching the prepareStyles method to ignore muiPrepared when passing style props onto react. var theme = getMuiTheme({}, { userAgent: ... });
var original = theme.prepareStyles;
theme.prepareStyles = function(style) {
var out = style.muiPrepared ? style : original(style);
if (out && out.muiPrepared) {
delete out.muiPrepared;
}
return out;
}; Hope that helps! |
@OshotOkill So how do you get the code working isomorphically? |
Well, for those who are googling for this issue: I managed to sort out the @connect(model => ({ navigator: model.navigator }))
export default class Form extends Component
{
getChildContext()
{
return {
muiTheme: getMuiTheme({ userAgent: this.props.navigator.userAgent })
}
}
}
// `navigator` reducer must also be created otherwise `navigator` will be `undefined` It fixed the autoprefixer "React attempted to reuse markup" warning, but here's the new one:
The cause of the error is this weird autogenerated id: This issue is unresolved and is described in #3757 |
Solved the issue but setting plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
] |
Problem description
I could see the below warning even after passing the
userAgent
while rendering on the server side. Please assist me on this , if I am doing anything wrong.On the client side React is trying to reuse markup(component) , since checksum is invalid so it is throwing the warning.
I could see the issue is due to Isomorphic styling and node is not able to compile the CSS (I may be wrong).Code
https://github.com/sabha/React-Redux-Router-MaterialUI-ServerSideRendering
Server Side Rendering
Client Side Render
MUI Component
The text was updated successfully, but these errors were encountered: