question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Container] classes generated wrongly after migration to emotion

See original GitHub issue
  1. Something interesting happening to clsx if classes.disableGutters is undefined or classes.fixed is undefined

image image

But both combination produces just first undefined? image

  1. While using maxWitdh=false generates unnecessary class MuiContainer-maxWidthFalse image
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

  1. generates class MuiContainer-maxWidthFalse
  2. Generates undefined classes on fixed, disableGutters properties while using clsx.

Expected Behavior 🤔

  1. Using maxWitdh=false should not generate class maxWidthFalse
  2. No undefined classes should be applied.

Steps to Reproduce 🕹

Updated version from “@material-ui/core”: “5.0.0-alpha.21” to “@material-ui/core”: “5.0.0-alpha.22” Reference playground

Overall this probably should be changed to this.

const useUtilityClasses = (styleProps) => {
  const { classes = {}, fixed, disableGutters, maxWidth } = styleProps;

  const maxWidthClassName = `maxWidth${capitalize(String(maxWidth))}`;

  return {
    root: clsx(
      containerClasses.root,
      classes.root,
      typeof maxWidth === "string" && getContainerUtilityClass(maxWidthClassName),
      typeof maxWidth === "string" && classes[maxWidthClassName],
      fixed && containerClasses.fixed,
      fixed && classes.fixed,
      disableGutters && containerClasses.disableGutters,
      disableGutters && classes.disableGutters,
    )
  };
};

Context 🔦

Updating version.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
povilasscommented, Jan 12, 2021

@oliviertassinari Yes it works updated and I used https://ci.codesandbox.io/status/mui-org/material-ui/pr/24371 to find the correct pull request and how to install it to my repository.

1reaction
povilasscommented, Jan 12, 2021

OK let’s wait for the new version for now I think we can close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Container] classes generated wrongly after migration to emotion
Generates undefined classes on fixed, disableGutters properties while using clsx. Expected Behavior. Using maxWitdh=false should not generate ...
Read more >
material v5 migration: migrate from JSS to Emotion
However, when I try to run my app, I have the following error on all child components but not on the root parent...
Read more >
Migration to emotion - HackMD
Migration to emotion. Converting styles from JSS to emotion. Things to consider when migrating component's styles to emotion.
Read more >
Why We're Breaking Up with CSS-in-JS - DEV Community ‍ ‍
Hi, I'm Sam — software engineer at Spot and the 2nd most active maintainer of Emotion, a widely-popular CSS-in-JS library for React.
Read more >
Material UI v5 is out, and I'm unsure if I like the move ... - Reddit
I'd love to hear people's experiences with Emotion and how it benefits ... I will say that that after reading over the migration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found