-
-
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
[StyledEngineProvider] Fix issue with cache not being defined #36162
Conversation
Netlify deploy previewNo updates. Bundle size report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could write a test for this? Is it possible to remove document
at the beginning of the test?
The problem with removing the document is that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you like we could also revert this change and improve the check I added in #36001. For mui/mui-x#7770, I only need to prevent creating the cache if MUI Core is being used inside a web worker. My first idea was to check the presence of document
because the error message mentioned this, but checking if importScript
is available (there're other approaches too) might be more reliable to avoid false-positives.
@m4theushw can this be conditionally added on MUI X side (for example using |
No, we actually don't even use |
Fixes #36096, a regression from #36001. The emotion cache provided previously could have been undefined, which was throwing an error. The changes were tested locally, the codesandboxes takes ages to load for me 😕
Before: https://codesandbox.io/s/lucid-dan-n6hu29?file=/package.json
After: https://codesandbox.io/s/pensive-violet-on5wym?file=/package.json