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

v0.2 #89

Merged
merged 16 commits into from
May 5, 2022
Merged

v0.2 #89

merged 16 commits into from
May 5, 2022

Conversation

pacocoursey
Copy link
Owner

@pacocoursey pacocoursey commented Feb 20, 2022

Fixes #107
Fixes #106
Fixes #99
Fixes #94
Fixes #90

@vercel
Copy link

vercel bot commented Feb 20, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

next-themes-basic – ./examples/example

🔍 Inspect: https://vercel.com/paco/next-themes-basic/BLa2jTB8WtgScdZ4Fv9PFKoHMBpC
✅ Preview: https://next-themes-basic-git-02-paco.vercel.app

next-themes-tailwind – ./examples/tailwind

🔍 Inspect: https://vercel.com/paco/next-themes-tailwind/Ct5v453mbkAZhaQKkpLY7ngx7A1f
✅ Preview: https://next-themes-tailwind-git-02-paco.vercel.app

@nihgwu
Copy link

nihgwu commented Mar 1, 2022

I was bothered by the first flash with latest version, and then I found this, now I'm using next-themes@0.2.0-beta.0 and it works like a charm

@kevinzwhuang
Copy link

@pacocoursey

We're running into the following error that occurs in the beta build & on v0.1.1.

Uncaught TypeError: Cannot set properties of undefined (setting 'colorScheme')
            <script>
                !function() {
                    var d = document.documentElement.classList;
                    d.remove('light', 'dark');
                    d.style.colorScheme = 'dark';
                    d.add('dark')
                }()
            </script>

We're using Tailwinds in the same app and have the following props set:

<ThemeProvider
  attribute="class"
  defaultTheme="dark"
  forcedTheme="dark"

@vercel
Copy link

vercel bot commented May 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-themes-basic ✅ Ready (Inspect) Visit Preview May 5, 2022 at 3:24AM (UTC)
next-themes-tailwind ✅ Ready (Inspect) Visit Preview May 5, 2022 at 3:24AM (UTC)

@pacocoursey
Copy link
Owner Author

pacocoursey commented May 5, 2022

I was delaying this PR in hopes that vercel/next.js#36364 would fix the bug in Next.js where beforeInteractive was incompatible with inline scripts so I could remove my base64 hack. However, it's still completely broken and I've lost faith in next/script entirely.

telegram-cloud-photo-size-1-5159311163920591462-y

So, let's move ahead with a regular script tag at the top of the body. I was worried not putting the script inside <head> would cause a flash on some browsers, but testing latest Safari, Brave, Firefox, and Chrome shows that it works correctly.

@pacocoursey pacocoursey marked this pull request as ready for review May 5, 2022 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants