Material-ui: CSS blinking with NextJS

Created on 31 Aug 2017  路  10Comments  路  Source: mui-org/material-ui

Problem description

While using Material-UI with NextJS, there is a "CSS blinking" on first loading. So when I reload page, I don't have any styles at all. After 0.5 sec styles are applied, the whole content is jumping and looks beautiful. But this behaviour looks awfully. I'm not sure if this is a problem from your side or from NextJS. So sorry if it's a wrong place for this issue.

Steps to reproduce

Download example from this link and launch it.
https://github.com/callemall/material-ui/tree/v1.0.0-beta.6/examples/nextjs

Versions

  • Material-UI: next
  • React: latest
  • Browser: Chrome 60
bug 馃悰

All 10 comments

Yes, exactly same behaviour. As I wrote in the issue, I use Material-UI: next, which is the latest version (1.0.0.7). So as I understand, everything is similar between these examples.

I was wondering as you used the beta.6 r茅f茅rence on the issue description.

Ye, I saw this too, but at that moment I couldn't find an example with the latest version.

But returning back to the issue, do you have any ideas about it?

I confirm the issue. I'm having a look.

I have figured out the issue. The example was recycling the same sheetsManager between different requests. Meaning that it's working for the first time, the second time, he thinks that the style is already injected so he skips them. Providing a new instance at each SSR render fix the issue.

I'm still seeing flicker in the instapaper theme with nextjs....

@aliogaili @oliviertassinari I'm facing this issue too. I don't understand when it was solved and how. :eyes:

@oliviertassinari That's not what I mean. Well, I'll try to explain it so.
I can see that we need to respect the order of components: Box needs to come at the top level before Typography, but there's not enough.

Here's a screenshot from the first load of the page. It brings the correct style and 1 second later, it shows up as below:

image

And here's the same page, but when I navigate back to it:

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

revskill10 picture revskill10  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

FranBran picture FranBran  路  3Comments

ghost picture ghost  路  3Comments

finaiized picture finaiized  路  3Comments