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

Fix Prop nonce did not match error #223

Closed
wants to merge 1 commit into from
Closed

Conversation

Enalmada
Copy link

I am getting Warning: Prop `nonce` did not match. Server: "" Client: "rj3157e91u" despite passing in a nonce.
When trying to search for why this error is happening I found this: https://github.com/kentcdodds/nonce-hydration-issues
TLDR: Apparently the browser, for security reasons, clears the nonce the way that next-themes is creating script tag. This leads to a mismatch, causing the warning.

I believe this fixes: #218

I have created a build with this fix for testing and it seems to work:
"@enalmada/next-themes": "^0.2.3",

@vercel
Copy link

vercel bot commented Oct 10, 2023

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

Name Status Preview Comments Updated (UTC)
next-themes-basic ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 1:32am
next-themes-tailwind ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 1:32am
next-themes-with-app-dir ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 1:32am

@Enalmada Enalmada changed the title Fix Prop nonce did not match. error Fix `Prop nonce did not match.` error Oct 10, 2023
@Enalmada Enalmada changed the title Fix `Prop nonce did not match.` error Fix Prop nonce did not match error Oct 10, 2023
@flux0uz
Copy link

flux0uz commented Jan 23, 2024

UP facing the same issue !

@robertclarkson
Copy link

Got this issue

@pacocoursey
Copy link
Owner

Fixed in #262

@r34son
Copy link

r34son commented Mar 13, 2024

Also facing after upgrade to 0.3.0

@dimaMachina
Copy link
Contributor

@pacocoursey I think you missed to include this change in 0.3 release https://www.unpkg.com/[email protected]/dist/index.js

@pacocoursey
Copy link
Owner

No, it was merged after. #262 hasn't been released yet, but the issue is fixed in the source code.

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

Successfully merging this pull request may close these issues.

How to pass nonce to ThemeProvider in _app.tsx?
6 participants