jss instance counter (moduleId) causes SSR class name mismatch
See original GitHub issueI hope I can impress upon everyone that using counters for class names is very, very brittle and I’ve had to work through dozens of server/client class name mismatches because of counters. I’m getting pretty tired of it, and it doesn’t seem sustainable to me.
This latest problem comes from the apparently new moduleId.js
jss instance counter getting worked into the generated class names. Here’s the error I’m getting:
Warning: Prop `className` did not match. Server: "MuiSvgIconroot-1-2-26 MuiIconButtonicon-1-2-22" Client: "MuiSvgIconroot-0-2-26 MuiIconButtonicon-0-2-22
I know you’ll probably say it’s up to us to ensure that the same jss instances get created in the same order on the server and client. But this is getting increasingly difficult as some libraries like material-ui
create their own jss
instances.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:27 (26 by maintainers)
Top Results From Across the Web
Class name hydration mismatch in server and client, (Warning
I don't know this way is proper or not, But it works well, Actually, I find out, using separate RTL Component, is not...
Read more >react-scrollama - UNPKG
node_modules/core-js/library/modules/_an-instance.js",". ... NODE_ENV;\n\n/**\n * Returns a function which generates unique class names based on counters.
Read more >youtube-danmaku - Source code - Greasy Fork
We need to reset the rule counter for SSR for each request. ... disableGlobal) { // We can use a shorthand class name,...
Read more >gatsby | Yarn - Package Manager
fix SSL naming error caused by @ scoped package name in develop (#10863 (b5209b9) ... It was disabled while trying to debug the...
Read more >the of and to a in for is on s that by this with i you it not
... jobs provide food source author different press learn sale around print course job canada process teen room stock training too credit point...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I guess I’ll spend some time thinking about the details of a less brittle approach then and let you know once I’ve figured it out.
see https://github.com/cssinjs/jss/issues/658 and https://github.com/cssinjs/jss/issues/677