-
-
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
[material-ui] esm.sh Typography component is not picking up the theme from the ThemeProvider #44509
Comments
Probably due to difference instance for the React Theme context. I'm not sure if we want to spend time to fix this. |
Can you explain why you wouldn't want to fix this? Is it a bug in material-ui or not? Is there a work around? |
The workaround is to import from https://codesandbox.io/p/sandbox/mui-esm-sh-themeprovider-forked-2swlp9 |
Your fork is still not picking up myTheme through the theme provider. |
@siriwatknp thanks for your help so far. Here is an example that shows that your workaround isn't working. I added the following to your workaround attempt. See https://codesandbox.io/p/sandbox/icy-voice-fzf82f
This is not getting picked up in your modification to the line
However, as I mentioned in my error report, if I append the import urls with '?dev' then the ThemeProvider does provide myTheme correctly and the Typography h1 does get the correct fontSize and color. See https://codesandbox.io/p/sandbox/awesome-mendeleev-mddzqh So the production import urls are not working and the development import urls are. Also I tried older version of material. I found that version 15.6.7 from 4 months ago was the newest version that works. See https://codesandbox.io/p/sandbox/nameless-moon-8xwxq4 I hope that is useful information for you. Do you really think this is low priority error? It seems serious to me. |
Is esm.sh resolving a single instance of React |
Hey @Kulodo, thanks for the report.
This is interesting. Do you know what is the difference in outcome with Thanks in advance. |
Hi @DiegoAndai Thanks so much for getting back to me. From https://esm.sh/#docs it says
In the devtools on code sandboxes i've linked above you can see in the sources tab you can see what has been loaded from esm.sh. Below you can see the development versions of MUI have been loaded. You can compare what esm loads with and without '"?dev". Also note above that in one of the codeboxes linked above I found the newest previous version of MUI that allowed my example app to work correctly. It was 15.6.7 from 4 months ago. So maybe you could compare what is loaded from esm.sh in 15.6.7 and the current latest version that isn't working. |
Steps to reproduce
Steps:
Current behavior
The Typography component with text Heading 1 is displayed using the default theme eg fontSize is 6rem.
Expected behavior
The Typography component should pick up the theme provided by the ThemeProvider. i.e The font size of the h1 should therefore be 1rem as defined in the theme. The color should also be green.
Context
I am trying to apply a theme using ThemeProvider to the Typography component.
Note I am importing mui and react from esm.sh.
Interestingly if I append the import urls with '?dev' then the Typography component does pick up the theme from the ThemeProvider correctly.
Your environment
The live example is at https://codesandbox.io/p/sandbox/l9tkcj
I am using esm.sh to import.
Search keywords: Typography ThemeProvider
The text was updated successfully, but these errors were encountered: