Next-plugins: FOUC on Next8 production build withCSS

Created on 24 Apr 2019  路  3Comments  路  Source: vercel/next-plugins

Bug report

Describe the bug

On a minimal project (only Next, React and Next-css are installed - check the repo below), there is FOUC on load. With the cache, it sometimes happens, with cache disabled, it happens all the time.

This problem doesn't happen in Next 7.

To Reproduce

Reproduce project: https://github.com/suppayami/test-fouc

  1. Run npm run build
  2. Run npm start
  3. Go to listening server and see the text with background, it has transition to easily notice the FOUC.

Expected behavior

There shouldn't be any FOUC on load.

System information

  • OS: macOS, Windows
  • Browser: Chrome
  • Version of Next.js: @^8.1.0

Additional context

The problem did not happen when I use Next.js @^7
It seems that this only happens if using next-css. Styled-jsx does not proc any FOUC.
This happens also in with-next-css example (put transition to style for easy notice): https://github.com/zeit/next.js/tree/master/examples/with-next-css

Most helpful comment

Seem to be caused by a chromium bug. Adding a script tag containing a single space to the footer of the page fixed the problem for me.
(I found the solution here: https://stackoverflow.com/questions/14389566/stop-css3-transition-from-firing-on-page-load#answer-42969608)

All 3 comments

Same problem with withSass (@zeit/next-sass) or withLess (@zeit/next-less).

Seem to be caused by a chromium bug. Adding a script tag containing a single space to the footer of the page fixed the problem for me.
(I found the solution here: https://stackoverflow.com/questions/14389566/stop-css3-transition-from-firing-on-page-load#answer-42969608)

Confirmed @nathan818fr workaround worked.

Was this page helpful?
0 / 5 - 0 ratings