You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple instances of Material UI get imported using web components
The issue is present in the latest release.
I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 馃槸
Two react components are created. Both of them are using material ui button and makeStyles hook to change the background of this button. First one is yellow, the second one is blue.
The second component was build productive as a web component (using direflow, but it shouldn't matter) and imported in the first component
Second button is placed near the first button. Project started
The first button is purple instead of yellow
Expected Behavior 馃
Yellow button and the blue button near the first one
While loading the page and inspecting it, it is too see, that multiple instances of Material UI were loaded. This also overrides the rules, that were defined in the upper stylesheet.
As we can see the second load from material UI (from component 2) sets .Mui classes on top of makeStyles-button-1
If you delete the second component then the button will be yellow
You need to configure JSS to inject the style in each shadow dom. Unless you have a strong use case for use web components, I wouldn't encourage them. I'm closing for #17473.
You need to configure JSS to inject the style in each shadow dom. Unless you have a strong use case for use web components, I wouldn't encourage them. I'm closing for #17473.
But I'm not using shadow dom. You can see it on the last screenshot in Chrome Dev Tools.
@GeorgeBalat Please provide a reproduction in this case. A live example would be perfect. This codesandbox.io templatemay be a good starting point. Thank you!
Multiple instances of Material UI get imported using web components
Current Behavior 馃槸
Expected Behavior 馃
Yellow button and the blue button near the first one
While loading the page and inspecting it, it is too see, that multiple instances of Material UI were loaded. This also overrides the rules, that were defined in the upper stylesheet.
As we can see the second load from material UI (from component 2) sets .Mui classes on top of makeStyles-button-1
If you delete the second component then the button will be yellow
Your Environment 馃寧
`npx @material-ui/envinfo`
The text was updated successfully, but these errors were encountered: