-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Theme switching doesn't work with Remix #31140
Comments
Thanks @mnajdova for pointing me in the right direction, I've hacked around this but I get a very weird error in the console: |
@arpitdalal have you resolved the use with the |
@mnajdova I haven't resolved it yet, just can't understand where the problem is. Thank you for replying |
All I see when I open the sandbox is the message: Upgrade Required. Just curious, did you try to import the |
@mnajdova Just open this: https://si7i0x-3000.sse.codesandbox.io/ and you'll see the error in the console. I think codesandbox doesn't like Remix or I'm making some mistake in the config but you gotta add the |
@mnajdova I tried to replace the imports from |
Alright, will look in to it next week. |
Hey @mnajdova Have you had a chance to look into this yet? Because it doesn't make any sense to me when it complains about an internal function of MUI 🤷♂️ |
It’s on my list for tomorrow, will respond once I have something |
I've spent an hour on this, but I have no idea why it is happening. It's not showing on the examples project. I would propose changing the code step by step and see when it starts appearing. I am sorry I couldn't help more. |
Okay @mnajdova, thanks for checking, I'll try to reverse engineer this and see what is the cause for that error. I'm just trying to persist the theme in Error and Catch Boundaries because the example doesn't do that right now. Please correct me if I am wrong here. |
i am having the same issue upgrading my react vite app from @mui/material 5.4.3 to 5.5.0, As Remix uses Vite under the hood this issue should be renamed to "Theme switching doesn't work with Vite" |
maybe it is with |
@mnajdova and @jacobgad I think I found the issue (sort of) and discovered that there is something wrong with v5.5.0 In this og-codesandbox I was defining so in this fixed-codesandbox I moved that But, if I upgrade @mnajdova please advice about the above^ |
Ok, using |
This is strange and doesn't make much sense. |
I agree, but Remix does things to code split between server and client, could that be an issue? I don't know |
Could be, it's more likely to be an issue with remix, as the error occurs if things are moved in the folder structure over there in the project. Maybe some of the files need to be duplicated for both the client and the server. |
Thanks for the reply, |
@mnajdova I fixed the I think it is I will close this issue since it is "resolved". |
Alright, please open a new issue for |
@arpitdalal Hi, I have same error with default Remix template, but it happens only if I use Icons: #32891 |
I commented on the esbuild ticket but if somebody gets stuck this worked for me, change the import and remove '/styles' in my theme.ts, if I use below, I can reproduce the issue: createTheme_default is not a function import { createTheme } from '@mui/material/styles'; But if I use this line below, it fixes it: import { createTheme } from '@mui/material'; remix / material, all npm "latest" |
I wrote the same thing in this issue because it was the first to pop up on google: #31835 (comment) I was getting the If your project was set up using the Remix MUI Example, then the fix for me was to add the import * as React from "react";
import Container from "@mui/material/Container";
import Box from "@mui/material/Box";
import CssBaseline from "@mui/material/CssBaseline";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Container maxWidth="sm">
<Box sx={{ my: 4 }}>
<CssBaseline />
{children}
</Box>
</Container>
);
} although, still getting Final Update: |
See this commnet for concise findings of this issue and a couple of temporary workarounds. |
Kindly resolve this issue as soon as possibleand it's quite unexpected error Uncaught TypeError: createTheme_default is not a function at Box.js:9:22 |
We know |
Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information. |
I could not reproduce this in the latest remix/react-router. If someone can reproduce this, please open up a new issue with a reproducible. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @arpitdalal 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. |
Duplicates
Latest version
Current behavior 😯
The theme in
ErrorBoundary
andCatchBoudnary
of remix doesn't match with rest of the app.Expected behavior 🤔
The theme selected should be respected in
ErroBoundary
andCatchBoundary
too.Steps to reproduce 🕹
Steps:
dark
if not alreadyTest Root CatchBoundary
linkdark
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`
The text was updated successfully, but these errors were encountered: