Skip to content
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 with Next.js app router #851

Open
pmillspaugh opened this issue Jul 22, 2024 · 0 comments
Open

FOUC with Next.js app router #851

pmillspaugh opened this issue Jul 22, 2024 · 0 comments

Comments

@pmillspaugh
Copy link

Do you want to request a feature or report a bug?

Report a potential bug. Thanks in advance!

What is the current behavior?

  • FOUC on page load
  • CSS doesn't load at all with JS disabled
Screen.Recording.2024-07-22.at.3.10.14.PM.mov

If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar

Here's a repro I created with npx create-next-app@latest: https://github.com/pmillspaugh/styled-jsx-fouc-test

There's no FOUC with CSS modules, but the simple styled-jsx example I added to app/page.tsx produces FOUC.

What is the expected behavior?

I expect the CSS to be included in SSR, produce no FOUC, and still load with JS disabled. It sounds like Next.js v12 and up manage SSR for you.

Environment (include versions)

  • Version of styled-jsx (or next.js if it's being used): Next.js v14.2.5 and styled-jsx v5.1.1 (as dep of next)
  • Browser: reproduced on Chrome, Safari, Firefox
  • OS: MacOS

Did this work in previous versions?

From other issues I've looked through, it sounds like a mixed bag. Some others reported FOUC, e.g. #681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant