Open LvChengbin opened 2 years ago
Would you like to create a PR to improve it?
For context, this logic is only here for backward compatibility with v4. It makes it possible for JSS to generate global class names unless themes are nested.
We can drop the logic in v6 as we drop @mui/styles
.
Duplicates
Latest version
Current behavior 😯
ThemeProvider try adding a property
Symbol( mui.nested )
to the original theme object.https://github.com/mui/material-ui/blob/7c75acec84879d013ae8e68ff319baf9fef1045e/packages/mui-private-theming/src/ThemeProvider/ThemeProvider.js#L58
It causes error while using some state management libraries, such a Recoil, to manage theme objects, because the libraries may freeze objects they are handling, then Error
Object is not extensible
will be thrown.On the other hand, changing origin object will also cause other side effects.
Expected behavior 🤔
Don't change the original object.
Steps to reproduce 🕹
Steps:
1. 2. 3. 4.
Context 🔦
No response
Your environment 🌎
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo