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.

Un stable rendering of production build for material UI example for nextJS

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

When page is reloaded, the render should be stable. It is correct in the development build, i.e when I do npm run dev

development

Current Behavior

When page is loaded, the render is unstable. It happens when I run npm run build and npm run start

production

Steps to Reproduce (for bugs)

Following the instructions at https://github.com/zeit/next.js/tree/canary/examples/with-material-ui-next

  1. curl https://codeload.github.com/callemall/material-ui/tar.gz/v1-beta | tar -xz --strip=2 material-ui-1-beta/examples/nextjs
  2. cd nextjs
  3. npm run build
  4. npm run start

Context

Your Environment

Tech Version
Material-UI 1.0.0-beta.25
React 16.2.0
browser Chrome 63.0.3239 on MacBook
Next 4.2.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:27 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
krazyjakeecommented, Apr 3, 2018

@bendiy I then refresh the browser, It looses it's style and renders weird and throws the error I have this exact issue.

@oliviertassinari I started a project recently and was looking at after.js and next.js as being the source of this issue, but I think the closest I’ve come to an actual solution is your comment: It's the sign your class name generator is shared between different request. Could you please explain where in a project I should be declaring createGenerateClassName and how to make the styling stick on further requests?

My code:

static async getInitialProps({ assets, data, renderPage }) {
    const sheets = new SheetsRegistry();
    const generateClassName = createGenerateClassName();

    const page = await renderPage(After => props => <JssProvider registry={sheets} generateClassName={generateClassName}>
      <Layout><After {...props} /></Layout>
    </JssProvider>
    );
    return { assets, data, sheets, ...page };
  }
3reactions
oliviertassinaricommented, Dec 29, 2017

@credifiable Sorry, but you seem to be the only one affected. We can’t do anything without being able to reproduce. Keeping the issue open won’t help with the exposure, most people use the search of GitHub to find old issues they are suffering. Maybe someone will face the same issue and dig into the rabbit hole.

@JeromeFitz Thank you for the live environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Un stable rendering of production build for material UI ...
I am now reading how HTML code is generated using nextjs framework, to understand why there is a curl difference between two setups....
Read more >
Material UI breaks NextJS app in production - Stack Overflow
The app compiles and builds without errors when I run "next build". When I run it with NODE_ENV=production, the webpage renders just fine...
Read more >
Next.js by Vercel - The React Framework
Production. Next.js gives you the best developer experience with all the features you need for production: hybrid static & server rendering, TypeScript support, ......
Read more >
Next.js with Material-UI - ITNEXT
Material UI offers React components for faster and easier web development. You can create your own design system, or start with Material Design....
Read more >
Building The Real App With React Query - Smashing Magazine
The application is written in TypeScript and uses CRA, React query, Axios mock server and material UI for easier prototyping.
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