-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Unexpected Theme Switch to Light Mode After User Login #199
Comments
Also, this is my login handler: const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
setLoading(true);
const response = await signIn("credentials", { email, password, redirect: false });
if (response?.url) {
router.push("/");
router.refresh();
} else {
toast.error("Oops! Unable to sign in. Please check your email and password.");
setPassword("");
setLoading(false);
}
}; |
Same thing happing with me.. even though in local storage the theme is dark |
Any updates regarding this issue? |
I've noticed that the bug happens when I use |
Any updates? |
similar issue, did you find any solution for it? @sayandedotcom @therealtgd |
Still no fix. |
facing the same with https://next-international.vercel.app when locale is changed router.refresh() is triggered and there is flickering after router.refresh, although first page load is fine without flickering |
anyone got a fix on this? I also noticed that the same thing happens when navigating through different layouts. |
Description:
After integrating the next-themes library into my Next.js application, I encountered an unexpected behavior related to theme switching. I'll describe the issue below without sharing my app's source code or providing access to the app itself.
Steps to Reproduce:
Navigate to the application in a fresh browser session.
Observe that the default theme is correctly set to dark mode.
Log in as a user.
Observe that the UI unexpectedly switches to light mode, even though the theme is set to dark mode.
Expected Behavior:
The theme of the application should consistently remain in dark mode after the user logs in, as configured in the next-themes library's
ThemeProvider
.Actual Behavior:
After the user logs in, the UI switches to light mode, despite the theme being set to dark mode.
Relevant Code:
theme.provider.tsx
layout.tsx
Additional Information:
Application framework:
Next.js v13.4.12
Authentication library:
NextAuth.js v4.22.5
Theme management library:
next-themes v0.2.1
Other relevant libraries and dependencies:
tailwindcss v3.3.3
Environment:
Operating System: macOS 13.4.1
Browser: Chrome Version 115.0.5790.170 (Official Build) (arm64)
The text was updated successfully, but these errors were encountered: