-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
MUI + NextJS + Redux - Dark Theme switch not working on SSR #44949
Comments
Is it required to use Redux? If not, I recommend following:
|
@siriwatknp I have updated the code with |
@karthikdivi Please check my commit. The fix is to combine light and dark theme into a single theme within I don't see a need to use redux. If you want to get the selected mode, you can use |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @karthikdivi How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Steps:
npm install --legacy-peer-deps
andnpm run dev
Current behavior
Dark mode not getting applied.
Expected behavior
On refreshing the page the dark mode should apply.
Context
When I switch the theme to Dark mode, it updates the Redux state and also preserved to LocalStorage. When I do a hard refresh in the browser, reading the theme preference from Redux and applying it. But the Dark theme is not showing.
Screen.Recording.2025-01-06.at.1.53.20.PM.mov
Your environment
npx @mui/envinfo
Search keywords: nextjs dark mode
The text was updated successfully, but these errors were encountered: