New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FOUC only in production on latest Firefox #22465
Comments
I've also confirmed this behavior with the latest |
The FOUC seems to go away when using |
This might help: After hours of troubleshooting sudden FOUC in my next.js app (deployed at Vercel with styled-jsx, problems in production mode only) I discovered that I had styled-jsx installed as a separate package in my app. This created some conflict with next.js built-in styled-jsx. Deleting the package fixed it. |
Trying fix for vercel/next.js#22465 recommended by @elinlutz.
@elinlutz Thanks for the tip! Didn't seem to work though.... still got a FOUC in production while using Firefox. I'm using mostly SCSS modules ( |
Trying fix for vercel/next.js#22465 recommended by @elinlutz.
Also having this issue + also using SCSS modules. Is there a trend there or anyone else experiencing this and not using SCSS? |
@muntasirsyed I'm also using SCSS modules and having the issue. Haven't tried it without SCSS or modules yet |
not sure if I'm stating the obvious here, but FWIW both of the videos just show a cursor moving around a black screen. |
@developit Yup, sorry. Just updated the original issue comment with GIFs that should show the FOUC properly. |
I have the same issue on the project I'm working on. And that happens also on chrome (I see that only on your portfolio example as well). We're using styled-components, and nothing I've done is correcting this behaviour (tried many things already). I don't have any conflicting styled-jsx, I'm using 10.0.9 version of nextjs). I've finally opted to just hide the content until the js is loaded, but that's not a good solution for SSR. |
Weird update: The FOUC seems to go away when using a Firefox private browsing window. Perhaps it has something to do with local storage data or service workers or something... 🤷 |
I'm guessing that the issue was introduced due to a Next.js change in how scripts are loaded. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1404468 This issue also appears on Vercel and the Next.js docs when JavaScript is disabled:
|
After some investigation, I think there are a couple of bugs at play here:
|
A hack workaround: add a dummy
Here's the 7 year old issues with FF lol https://stackoverflow.com/questions/21147149/flash-of-unstyled-content-fouc-in-firefox-only-is-ff-slow-renderer |
@pcmaffey Thanks! That looks like the workaround a lot of us are using (I also saw that StackOverflow answer). But I'm wondering if it has to do with Next.js changes... because it was working previously (e.g. before 10.x I think) without a FOUC. |
Facing the same issue, but what I have found out is that styles-jsx and material UI styles do get rendered on the server, while SCSS modules are loaded later through JS which causes a FOUC when styling your content with SCSS modules. |
Temporary fix for vercel/next.js#22465
Addresses vercel/next.js#22465 until it's fixed upstream (in Firefox).
Just checked with |
What version of Next.js are you using?
10.0.7
What version of Node.js are you using?
12.8.3
What browser are you using?
Firefox 85.0.1 (64-bit)
What operating system are you using?
Pop_OS! 20.04 (Ubuntu 20.04)
How are you deploying your application?
Vercel
Describe the Bug
I see a FOUC when accessing my production deployment on Firefox:
It seems to disappear when using Chrome or Firefox on mobile.
I also appear to get the same issue for my portfolio website on Firefox:
Expected Behavior
There should be no FOUC.
To Reproduce
Or, to reproduce locally:
yarn
).yarn dev:next
).You'll need some
env
files for that reproduction to work correctly. Instead, you can just reproduce the same FOUC using my portfolio website (which is a lot smaller than that repo anyways):yarn
).yarn dev
).The text was updated successfully, but these errors were encountered: