-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[styled-engine] Add caching to improve performance for running tests with Jest #45846
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
Conversation
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Netlify deploy previewhttps://deploy-preview-45846--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
…/styled-engine-jest
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.js
Outdated
Show resolved
Hide resolved
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.test.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Aarón García Hervás <[email protected]> Signed-off-by: Siriwat K <[email protected]>
Cherry-pick PRs will be created targeting branches: v6.x |
); | ||
const cache = React.useMemo(() => { | ||
const cacheKey = `${injectFirst}-${enableCssLayer}`; | ||
if (cacheMap.has(cacheKey)) { |
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.
FYI, I'm seeing an issue from this change in SSR where emotion thinks a node has already been inserted (because it was on a previous request that is now using a shared cache).
The fix I have patched into my repo is to change this if check to
if (typeof document === 'object' && cacheMap.has(cacheKey)) {
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.
opened PR here: #46276
closes #45638