-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[material-ui][docs] Add deprecations migration guide #40767
Changes from all commits
2e776b7
cf4d74b
c736429
d1cce84
43fb3c6
4cc8786
a652ff4
f8af7de
46623cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,51 @@ | ||||||||||
# Migrating from deprecated APIs | ||||||||||
|
||||||||||
<p class="description">Learn how to migrate away from recently deprecated APIs before they become breaking changes.</p> | ||||||||||
|
||||||||||
## Why you should migrate | ||||||||||
|
||||||||||
Features become deprecated over time as maintainers make improvements to the APIs. | ||||||||||
Migrating to these improved APIs results in a better developer experience, so it's in your best interest to stay up to date. | ||||||||||
Deprecated APIs often become breaking changes in subsequent major versions, so the sooner you migrate, the smoother the next major update will be. | ||||||||||
Check warning on line 9 in docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
|
||||||||||
|
||||||||||
## Migrating | ||||||||||
|
||||||||||
Material UI provides the `deprecations/all` codemod to help you stay up to date with minimal effort. | ||||||||||
|
||||||||||
```bash | ||||||||||
npx @mui/codemod@latest deprecations/all <path> | ||||||||||
``` | ||||||||||
|
||||||||||
This command runs all the current [deprecations codemods](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#deprecations), automatically migrating to the updated API. | ||||||||||
You can run this codemod as often as necessary to keep up with the latest changes. | ||||||||||
|
||||||||||
:::info | ||||||||||
|
||||||||||
If you need to manually migrate from a deprecated API, you can find examples below for all deprecations that have been added in Material UI v5. | ||||||||||
If you need to run a specific codemod, those are also linked below. | ||||||||||
|
||||||||||
::: | ||||||||||
|
||||||||||
## Accordion | ||||||||||
|
||||||||||
### TransitionComponent | ||||||||||
|
||||||||||
The Accordion's `TransitionComponent` was deprecated in favor of `slots.transition` ([Codemod](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#accordion-props)): | ||||||||||
|
||||||||||
```diff | ||||||||||
<Accordion | ||||||||||
- TransitionComponent={CustomTransition} | ||||||||||
+ slots={{ transition: CustomTransition }} | ||||||||||
Comment on lines
+37
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should follow the git diff format with our syntax connections (two space tab):
Suggested change
x the other cases |
||||||||||
/> | ||||||||||
``` | ||||||||||
|
||||||||||
### TransitionProps | ||||||||||
|
||||||||||
The Accordion's `TransitionProps` was deprecated in favor of `slotProps.transition` ([Codemod](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#accordion-props)): | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should link to the default branch here so it continue to work even when we are on v6
Suggested change
x the other cases |
||||||||||
|
||||||||||
```diff | ||||||||||
<Accordion | ||||||||||
- TransitionProps={{ unmountOnExit: true }} | ||||||||||
+ slotProps={{ transition: { unmountOnExit: true } }} | ||||||||||
/> | ||||||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import * as pageProps from 'docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md?@mui/markdown'; | ||
|
||
export default function Page() { | ||
return <MarkdownDocs {...pageProps} />; | ||
} | ||
Comment on lines
+1
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file pathname casing is wrong Actual: it leads to two bugs:
![]()
![]() Can we fix it? :) |
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.
I think that we should explain why we are making each deprecation. The very first thing as I developer I would want to understand is why am I going through this pain, what do I get? For example, https://mui.com/material-ui/migration/migration-v3/ illustrates this, we tried to justify why each breaking change.
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.
Yes! We have two overarching deprecation initiatives: standardizing the slots pattern and removing composed classes. I considered adding an explanation of those and then linking accordingly in each deprecation. Would that make sense?