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

Latest 5.10.7 Causes duplicate classes in snapshots #34502

Open
2 tasks done
httpete opened this issue Sep 27, 2022 · 15 comments
Open
2 tasks done

Latest 5.10.7 Causes duplicate classes in snapshots #34502

httpete opened this issue Sep 27, 2022 · 15 comments
Labels
component: FormControl The React component

Comments

@httpete
Copy link

httpete commented Sep 27, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Steps:

  1. upgrade to 5.10.7 from 5.10.6

Current behavior 😯

            >
              Sprite Icons
            </h2>
            <label
    -         class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-shrink MuiFormLabel-colorPrimary emotion-120"
    +         class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-shrink MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-shrink emotion-120"
              data-shrink="true"
              id="demo-simple-select-label"
            >

### Expected behavior 🤔

Take a look, the classes like MuiInputLabel-root are getting doubled up.

### Context 🔦

Jest snapshots should match without duplicate classes.

### Your environment 🌎

<details>
  <summary><code>npx @mui/envinfo</code></summary>
jest
</details>
@httpete httpete added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 27, 2022
@mnajdova
Copy link
Member

@httpete can you share the component that was rendered in the test in a Sandbox?

@mnajdova mnajdova added status: waiting for author Issue with insufficient information component: FormControl The React component and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 28, 2022
@httpete
Copy link
Author

httpete commented Sep 28, 2022

It's a Mui/InputLabel

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Sep 28, 2022
@mnajdova
Copy link
Member

Can't see it duplicated in this sandbox - https://codesandbox.io/s/inspiring-rumple-gt7jxf?file=/src/App.tsx please share the code that generated this output.

@mnajdova mnajdova added the status: waiting for author Issue with insufficient information label Sep 29, 2022
@oxc
Copy link

oxc commented Sep 29, 2022

I think that sandbox uses 5.0.0 of @mui/material. If I pick 5.10.7, I can reproduce it:

https://codesandbox.io/s/serene-mendel-iy02fz

image

@httpete
Copy link
Author

httpete commented Sep 29, 2022

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Sep 29, 2022
@httpete
Copy link
Author

httpete commented Sep 30, 2022

Just want to stress that it works fine in 5.10.6.

@vincentducorps
Copy link

vincentducorps commented Nov 8, 2022

Same for:

  • MuiBadge
    image

  • MuiButton
    image

We have a clue here, Base in class names has been removed.

@YuLingCheng
Copy link

I had the same issue on Button, Radio, Checkbox.
Checked the demos on mui and I could see duplicate classes as well
image
image
image

@lpolito
Copy link

lpolito commented Apr 17, 2023

This is still a problem as of v5.12.0, and is still demonstrated in the MUI demos. Any updates?

@kevinpfox
Copy link

kevinpfox commented Apr 28, 2023

As lpolito said, issue reproducible in demo files, below is from material-next-ts demo

ss0

Human readable version of the issue...

<a
  class="
    MuiButtonBase-root

    MuiButton-root
    MuiButton-contained
    MuiButton-containedPrimary
    MuiButton-sizeMedium
    MuiButton-containedSizeMedium

    MuiButton-root
    MuiButton-contained
    MuiButton-containedPrimary
    MuiButton-sizeMedium
    MuiButton-containedSizeMedium

    mui-style-zzzk6x-MuiButtonBase-root-MuiButton-root
  "

  tabindex="0"
  href="/"
>

  Go to the home page

  <span
    class="
      MuiTouchRipple-root
      mui-style-8je8zh-MuiTouchRipple-root">
  </span>

</a>

Issue visible in our own project with "@mui/material": "5.12.1"

Issue slows up in both dev and production builds of project.

@sag1v
Copy link

sag1v commented Jul 4, 2023

Hi, is this issue being worked on? Is there something we can do to help with the progress?

@mitoihs
Copy link

mitoihs commented Sep 4, 2023

It's still an issue in @mui@5.14.7

@kevinpfox
Copy link

kevinpfox commented Oct 31, 2023

This is still an issue with the latest MUI library versions and it affects production builds.

Screen caps below taken, with our project using the following library versions:
LATEST EMOTION
"@emotion/cache": "11.11.0",
"@emotion/react": "11.11.1",
"@emotion/server": "11.11.0",
"@emotion/styled": "11.11.0",
LATEST MUI
"@mui/lab": "5.0.0-alpha.150",
"@mui/material": "5.14.15",

Please address this issue so HTML isn't bloated with a duplicate set of class names.

double-the-necessary-amount-of-class-names-01

Human readable list of class names from above screen cap ^^
double-the-necessary-amount-of-class-names-02

ss2

@lpolito
Copy link

lpolito commented Nov 17, 2023

@mnajdova I was wondering if this was on anyone's radar?

@BRAiNCHiLD95
Copy link

BRAiNCHiLD95 commented Jul 3, 2024

So this is still definitely an issue. 😞

For me, any custom classes added via "classes" prop also seem to be duplicated in most cases (I use some tailwindCSS overrides).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: FormControl The React component
Projects
None yet
Development

No branches or pull requests

10 participants