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

[docs] Fix migration v5 docs #28530

Merged
merged 3 commits into from Sep 22, 2021
Merged

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Sep 22, 2021

Preview: https://deploy-preview-28530--material-ui.netlify.app/guides/migration-v4/

close #28477
close #28496


@siriwatknp siriwatknp added the docs Improvements or additions to the documentation label Sep 22, 2021
import { ThemeProvider, createMuiTheme, makeStyles } from '@mui/material/styles';
import { ThemeProvider, createMuiTheme, makeStyles } from '@material-ui/core/styles';
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the confusion pointed out in #28496. At this point, the developer is still using v4 so it should be @material-ui/core/styles instead of the new package.

@mui-pr-bot
Copy link

mui-pr-bot commented Sep 22, 2021

No bundle size changes

Generated by 🚫 dangerJS against 2ade1b2

@@ -66,7 +66,7 @@ const useStyles = makeStyles((theme) => {
});

function App() {
const classes = useStyles(); // ❌ If you have this, consider moving <ThemeProvider> to HOC and wrap the App
const classes = useStyles(); // ❌ If you have this, consider moving it inside a component that wrapped with <ThemeProvider>
Copy link
Member Author

Choose a reason for hiding this comment

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

Make it consistent to what we suggest in troubleshooting

Comment on lines 80 to 93
```sh
npm install @mui/material @mui/styles

// or with `yarn`
yarn add @mui/material @mui/styles
```

**Optional**: if you have one these packages, install the new package separately
- For `@material-ui/lab`, install `@mui/lab`
- For `@material-ui/icons`, install `@mui/icons-material`

<details>
<summary>See all packages change</summary>

Copy link
Member Author

Choose a reason for hiding this comment

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

Before the change it is very hard to know what should be the update. I think this is what most developer are looking for, the installation part with npm install or yarn add.

Comment on lines +132 to +133
> 📝 Please make sure that your application is still **running** without errors and **commit** the change before continuing the next step.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because v5 packages are separated from v4, the project should not crash after the installation. Add this note to remind developer to commit before running the codemod.

@mnajdova mnajdova merged commit 518810e into mui:master Sep 22, 2021
@@ -2737,3 +2762,17 @@ function App(props) {

export default App;
```

### TypeError: Cannot read properties of undefined (reading 'pxToRem')
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference with this case https://deploy-preview-28530--material-ui.netlify.app/guides/migration-v4/#makestyles-typeerror-cannot-read-property-drawer-of-undefined? It seems to be the same root issue, with different symptoms. I guess we won't add a h3 for each instance of where theme.x.y breaks 😁

Copy link
Member Author

Choose a reason for hiding this comment

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

If there are more similar issues open, I will group them together. The point that I added here is to help people see the error that match their case (cover as much as possible). I don't have strong evidence to prove my thought but I also don't see a downside of adding it.

- For `@material-ui/icons`, install `@mui/icons-material`

<details>
<summary>See all packages change</summary>
Copy link
Member

Choose a reason for hiding this comment

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

With this collapse, a developer wouldn't find what happened with @material-ui/core by searching on the page. I would advocate that @material-ui/core -> @mui/material should be made very clear, not implicit.


I don't think that it was clear before either:

Screenshot 2021-09-22 at 12 20 55

"you first need to update the package" Ok, but what goes where?

Copy link
Member Author

Choose a reason for hiding this comment

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

With this collapse, a developer wouldn't find what happened with @material-ui/core by searching on the page

Fair enough, I can remove the collapse.

"you first need to update the package" Ok, but what goes where?

I think this should change to "To use the v5 version of MUI Core, install these packages"

Copy link
Member Author

Choose a reason for hiding this comment

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

and mention that the package names have changed (I'm sure that some people will be surprised)

@iamchathu
Copy link

I think yarn add @mui/lab should be @mui/lab@next

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 23, 2021

I think yarn add @mui/lab should be @mui/lab@next

@iamchathu No need, the lab is always in an alpha state. We don't use @next in the docs: https://mui.com/components/about-the-lab/#installation.

I have run $ npm dist-tag rm @mui/lab next so that developers have an upfront error if they try to install @mui/lab@next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[styles] Cannot read pxToRem of undefined [CssBaseline/Migration] Change in default fontSize
5 participants