Skip to content

[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

Merged
merged 7 commits into from
Apr 9, 2025

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Apr 8, 2025

closes #45638


@siriwatknp siriwatknp requested a review from Copilot April 8, 2025 07:37
@siriwatknp siriwatknp marked this pull request as draft April 8, 2025 07:37
Copy link

@Copilot Copilot AI left a 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.

@mui-bot
Copy link

mui-bot commented Apr 8, 2025

Netlify deploy preview

https://deploy-preview-45846--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 02b4e31

@siriwatknp siriwatknp added v6.x needs cherry-pick The PR should be cherry-picked to master after merge labels Apr 8, 2025
@siriwatknp siriwatknp marked this pull request as ready for review April 9, 2025 01:41
Co-authored-by: Aarón García Hervás <[email protected]>
Signed-off-by: Siriwat K <[email protected]>
@siriwatknp siriwatknp merged commit aebc750 into mui:master Apr 9, 2025
19 checks passed
Copy link

github-actions bot commented Apr 9, 2025

Cherry-pick PRs will be created targeting branches: v6.x

);
const cache = React.useMemo(() => {
const cacheKey = `${injectFirst}-${enableCssLayer}`;
if (cacheMap.has(cacheKey)) {

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)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened PR here: #46276

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs cherry-pick The PR should be cherry-picked to master after merge performance test v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v6.4.8 causing Jest unit tests to take longer
4 participants