Conversation
Netlify deploy previewBundle size report
|
There was a problem hiding this comment.
Pull request overview
Removes the deprecated components / componentsProps API from Alert in MUI Material, aligning the component with the slots / slotProps customization model and updating related tests/types/docs for v9.
Changes:
- Removed
componentsandcomponentsPropshandling frompackages/mui-material/src/Alert/Alert.jsand from the public TypeScript types. - Updated
Alerttests to useslots/slotPropsfor close button/icon customization. - Updated API docs JSON + added a v9 migration note documenting the removed props.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mui-material/src/Alert/Alert.js | Removes deprecated prop support and simplifies forwarded slot configuration. |
| packages/mui-material/src/Alert/Alert.d.ts | Drops deprecated props from the public TS surface. |
| packages/mui-material/src/Alert/Alert.test.js | Updates tests to exercise slots/slotProps for close button/icon. |
| docs/translations/api-docs/alert/alert.json | Removes deprecated prop entries from translated API docs. |
| docs/pages/material-ui/api/alert.json | Removes deprecated prop entries from generated API JSON. |
| docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md | Documents the Alert deprecations removal and shows the replacement API. |
Comments suppressed due to low confidence (1)
packages/mui-material/src/Alert/Alert.js:175
- By removing
componentsandcomponentsPropsfrom the destructured props, any consumer still passing these (or having them in themedefaultProps) will leave them inside...otherand they will be forwarded to therootslot viauseSlot(as DOM attributes on the underlying element), causing React unknown-prop warnings and invalid HTML. Even if the props are removed from the public API, they should be explicitly omitted fromother(e.g. destructure them into unused variables) so they are not spread to the root slot.
const Alert = React.forwardRef(function Alert(inProps, ref) {
const props = useDefaultProps({ props: inProps, name: 'MuiAlert' });
const {
action,
children,
className,
closeText = 'Close',
color,
icon,
iconMapping = defaultIconMapping,
onClose,
role = 'alert',
severity = 'success',
slotProps = {},
slots = {},
variant = 'standard',
...other
} = props;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
3f59e9a to
e78fb7c
Compare
| ``` | ||
|
|
||
| #### Alert deprecated props removed | ||
|
|
There was a problem hiding this comment.
Document link to alert-props codemod like https://master--material-ui.netlify.app/material-ui/migration/upgrade-to-v9/#deprecated-apis-removed
|
|
||
| #### Alert deprecated props removed | ||
|
|
||
| The deprecated `components` and `componentsProps` props have been removed. Use `slots` and `slotProps` instead. |
There was a problem hiding this comment.
How about this format?
| The deprecated `components` and `componentsProps` props have been removed. Use `slots` and `slotProps` instead. | |
| The deprecated `components` and `componentsProps` props have been removed. | |
| Migrate to `slots` and `slotProps` with the codemod below: | |
| ```bash | |
| npx codemod … |
Uh oh!
There was an error while loading. Please reload this page.