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

Flashing in Firefox on first call and on every refresh #90

Closed
stffffn opened this issue Feb 24, 2022 · 8 comments · Fixed by #89
Closed

Flashing in Firefox on first call and on every refresh #90

stffffn opened this issue Feb 24, 2022 · 8 comments · Fixed by #89
Labels
bug Something isn't working

Comments

@stffffn
Copy link

stffffn commented Feb 24, 2022

Issue

The page flashes on first call and on every page refresh in Firefox with next-themes 0.1.1, if you have dark mode activated in your OS but no current local storage item regarding your theme choice.

This issue was introduced with version 0.0.16, downgrading to 0.0.15 fixes it.

Setup

SSG Next app with Tailwind. But the same applies if you try it with plain CSS modules.

Demo

0.0.15

nextthemes-0015

0.1.1

nextthemes-011

Versions

Next 12.1.0
Tailwind 3.0.22
next-themes 0.1.1
Firefox 97.0.1
macOS 12.2.1 (21D62)

@corn-flour
Copy link

I am having the same issue. Downgrading to 0.0.15 also solves the flashing.

Versions
Next 12.1.0
Tailwind 3.0.23
next-theme 0.1.1
Firefox 97.0.1 / Chrome 98.0.4758.109
macOS 10.15.7

@dstroot
Copy link

dstroot commented Feb 28, 2022

Seeing in Chrome as well.

@rminami
Copy link

rminami commented Mar 10, 2022

I'm seeing the same issue in both Firebox and Chrome as well.

  • next-themes 0.1.1
  • Next.js 12.1.0
  • Tailwind 3.0.23
  • Chrome 99.0.4844.51 / Firefox 98.0
  • macOS 12.2.1

@TGlide
Copy link

TGlide commented Mar 13, 2022

Using next-themes 0.2.0-beta.0 worked for me, in Firefox, Chrome and Safari.

@stffffn
Copy link
Author

stffffn commented Mar 13, 2022

Using next-themes 0.2.0-beta.0 worked for me, in Firefox, Chrome and Safari.

I tested it right now and unfortunately it doesn't fix the issue in Firefox (updated to 98.0 in the meantime).
It works only in Chrome (99.0.4844.51) and Safari (15.3) but I didn't have any issues in both browsers with next-themes 0.1.1 anyway. It only affects Firefox.

@ehteshamdev0
Copy link

I had the same issue, I downgraded to v0.0.15 and it seems to work as expected.

One side note: I see flashing screen in Firefox only when I run in dev mode yarn dev, though it works ok in chrome and safari in dev mode
The problem goes away with the build version (yarn build && yarn start). Works in all browsers

@pacocoursey
Copy link
Owner

Flashing in development is expected:

https://github.com/pacocoursey/next-themes#faq

@ehteshamdev0
Copy link

Flashing in development is expected:

https://github.com/pacocoursey/next-themes#faq

Yes I forgot to mention this FAQ link, it was a reference for others who are not aware of the behaviour.

@pacocoursey pacocoursey added the bug Something isn't working label May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants