question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jss instance counter (moduleId) causes SSR class name mismatch

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:27 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
jedwards1211commented, Jan 18, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found