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

Update Next.js example with latest Emotion #992

Closed
joeyvanlierop opened this issue Jun 10, 2020 · 3 comments · Fixed by #2068
Closed

Update Next.js example with latest Emotion #992

joeyvanlierop opened this issue Jun 10, 2020 · 3 comments · Fixed by #2068
Assignees
Labels
released This issue/pull request has been released.

Comments

@joeyvanlierop
Copy link

Describe the bug
When reloading a page which is supposed to display the current color mode's background color, a brief blue background is visible.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/joeyvanlierop/theme-ui-flicker
  2. Run yarn install and yarn dev
  3. Open http://localhost:3000 in your browser and reload the page to view the flicker

Expected behavior
The background should not flicker blue when reloading the page. Instead it should immediately show the current color mode's background color.
To view the expected behavior, uncomment this line in src/theme.js and reload the page.

Screenshots
In the example repository I have set a transition for the background color to further demonstrate the inital blue background. It is less evident (but still visible) without the transition. To view the flicker without any transition, comment out this line.

Additional context
The workaround that I am using by setting initialColorModeName to one of the color modes seems to be a very odd solution. There is a warning which outputs:

The initialColorModeName value should be a unique name and cannot reference a key in theme.colors.modes.

The docs state that initialColorModeName is used to define the key used for the top-level color palette, so I do not know why this fix works. Furthermore, if I change initialColorModeName to something other than light or dark, the flicker returns. I would appreciate any clarification on why this is happening. Thanks!

@lachlanjc lachlanjc added the bug Something isn't working label Dec 3, 2020
@lachlanjc
Copy link
Member

This problem has been fixed, but leaving this issue open for updating our Next example with a .babelrc file: https://github.com/vercel/next.js/blob/canary/examples/with-emotion/.babelrc

@lachlanjc lachlanjc self-assigned this Dec 6, 2020
@lachlanjc lachlanjc changed the title Body background color flicker on load with Next.js Update Next.js example with latest Emotion Dec 6, 2020
@lachlanjc lachlanjc removed the bug Something isn't working label Dec 7, 2020
@joeyvanlierop
Copy link
Author

@lachlanjc That's great to hear! Would you mind referencing the commit or pull request where this was fixed?

@hasparus hasparus added the prerelease This change is available in a prerelease. label Jan 10, 2022
@hasparus
Copy link
Member

🚀 Issue was released in v0.14.0 🚀

@hasparus hasparus added released This issue/pull request has been released. and removed prerelease This change is available in a prerelease. labels Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants