Theme switching doesn't work with Remix
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
The theme in ErrorBoundary
and CatchBoudnary
of remix doesn’t match with rest of the app.
Expected behavior 🤔
The theme selected should be respected in ErroBoundary
and CatchBoundary
too.
Steps to reproduce 🕹
Steps:
- Visit the codesandbox
- Toggle the theme to
dark
if not already - Hit the
Test Root CatchBoundary
link - You’ll see the
dark
theme but if you refresh the page, the theme will fallback tolight
for some reason and you’ll seeWarning: Prop 'content' did not match. Server: "#90caf9" Client: "#1976d2"
in the console. This warning is regarding the<meta name="theme-color" content={theme.palette.primary.main} />
tag in the root.
Context 🔦
I am trying to accomplish a successful MUI theme switch with error and catch boundaries too.
Your environment 🌎
`npx @mui/envinfo`
System:
OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
Binaries:
Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.12.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.12.0/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
@emotion/react: ^11.7.1 => 11.7.1
@emotion/styled: ^11.6.0 => 11.6.0
@mui/base: 5.0.0-alpha.69
@mui/icons-material: ^5.4.1 => 5.4.2
@mui/material: ^5.4.1 => 5.4.2
@mui/private-theming: 5.4.2
@mui/styled-engine: 5.4.2
@mui/system: 5.4.2
@mui/types: 7.1.2
@mui/utils: 5.4.2
@types/react: ^17.0.38 => 17.0.39
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
typescript: ^4.5.4 => 4.5.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:29 (11 by maintainers)
Top Results From Across the Web
The Complete Guide to Dark Mode with Remix
Adding dark mode without a toggle. Remix makes it unbelievably easy to add a theme based on the user's system preferences. Creating a...
Read more >Setting up Dark Theme with Remix and Stitches - Ross Moody
Set up the theme switcher The last piece of the puzzle is to put a Button on a route that changes the cookie's...
Read more >Remix-IDE Layout — Remix - Ethereum IDE 1 documentation
So you want to work on Remix with a dark theme or a light theme or just a different theme than the one...
Read more >Styling
In our experience, writing plain CSS had maintenance issues for a few reasons. ... styles change, browser and CDN caches for the other...
Read more >How to dynamically change tailwindcss theme color using ...
I'm using tailwindcss with Remix.run and trying to figure out how can I change ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mnajdova @jacobgad Here’s the
esbuild
issue: https://github.com/mui/material-ui/issues/31835@mnajdova I fixed the
useEnhancedEffect_default is not a function
by creating my ownuseEnhancedEffect
hook similar to MUI’s. Here’s the fixed-codesandbox-latest with latest @mui/material version and customuseEnhancedEffect
hookI think it is
esbuild
not building MUI dependencies into the build or similar and that’s why things are not a function.I will close this issue since it is “resolved”.
esbuild
problem needs its own issue to keep track of it. Thanks very much for the support!