Skip to content
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

DefaultPropsProvider breaks microfrontend setups - please move to @mui/styles #43186

Closed
csvan opened this issue Aug 5, 2024 · 5 comments
Closed
Assignees
Labels
customization: theme Centered around the theming features package: material-ui Specific to @mui/material package: system Specific to @mui/system status: waiting for author Issue with insufficient information

Comments

@csvan
Copy link

csvan commented Aug 5, 2024

Summary

The newly introduced DefaultPropsProvider (#42820) causes problems in micro-frontend setups, since it is located in the main @mui/material package which is usually too big to be shared between modules in a micro-frontend environment.

The root of the problem is that each module in the environment will get its own instance of DefaultPropsProvider, meaning that custom properties injected in an orchestrator (e.g. an App Shell) are erased on the module-level.

The common way to solve this issue would be to instead move this provider to a smaller, shareable package which can be shared. The best place is probably @mui/styles, which also houses the ThemeProvider (which also needs to be shared across modules).

Examples

No response

Motivation

Better support for micro-frontends.

Search keywords: DefaultPropsProvider

@csvan csvan added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 5, 2024
@zannager zannager added the package: system Specific to @mui/system label Aug 5, 2024
@siriwatknp
Copy link
Member

siriwatknp commented Aug 6, 2024

The DefaultPropsProvider in @mui/material is a reexport of @mui/system so the context is already created from a shareable package: https://github.com/mui/material-ui/blob/next/packages/mui-system/src/DefaultPropsProvider/DefaultPropsProvider.tsx#L6.

Can you provide a reproducible sandbox that replicate the issue you are facing? I can take a look.

@siriwatknp siriwatknp added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 6, 2024
@csvan
Copy link
Author

csvan commented Aug 6, 2024

@siriwatknp thanks for the reply! We already share @mui/system, and unfortunately the problem is still happening.

I will look into a reproducible example, but unfortunately our setup is proprietary and quite complex.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Aug 6, 2024
@mnajdova
Copy link
Member

mnajdova commented Aug 6, 2024

We already share @mui/system, and unfortunately the problem is still happening.

The behavior should already be the same for the ThemeProvider and the DefaultPropsProvider from @mui/system. You mentioned @mui/styles - this package is related to the v4 styling (makeStyles, etc).

One thing to make sure is to check that you have the same versions everywhere - this is most often the issue for ending up with different contexts.

@siriwatknp siriwatknp added customization: theme Centered around the theming features package: material-ui Specific to @mui/material and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 26, 2024
@siriwatknp siriwatknp added the status: waiting for author Issue with insufficient information label Dec 18, 2024
@siriwatknp
Copy link
Member

Close this issue as I think it's related to the setup, not Material UI. Feel free to reopen with reproducible sandbox/repo, I'm happy to take a look.

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@csvan 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization: theme Centered around the theming features package: material-ui Specific to @mui/material package: system Specific to @mui/system status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

4 participants