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

[material-ui][Modal] migrate useSlotProps to useSLot #42150

Merged
merged 22 commits into from
Jun 26, 2024

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented May 6, 2024

since #42469 is handling deprecating props, this PR focuses on migrating useSlotProps to useSlot

Not sure about argos failure, don't think it's related to this PR, same errors can be found in #42471 PR too

@sai6855 sai6855 added component: modal This is the name of the generic UI component, not the React module! deprecation New deprecation message package: material-ui Specific to @mui/material package: codemod Specific to @mui/codemod labels May 6, 2024
@sai6855 sai6855 marked this pull request as draft May 6, 2024 17:04
@sai6855 sai6855 changed the title [material-ui][Modal] Deprecte components, componentProps [material-ui][Modal] Deprecate components, componentProps May 6, 2024
@mui-bot
Copy link

mui-bot commented May 6, 2024

Netlify deploy preview

https://deploy-preview-42150--material-ui.netlify.app/

Drawer: parsed: -0.35% 😍, gzip: -0.43% 😍
SwipeableDrawer: parsed: -0.30% 😍, gzip: -0.38% 😍

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against c5066a8

@sai6855 sai6855 force-pushed the deprecta-modal-componentprops branch from 9750bba to f9d91d7 Compare May 29, 2024 17:27
@sai6855 sai6855 force-pushed the deprecta-modal-componentprops branch from 3b0add0 to ee945b8 Compare May 30, 2024 06:09
@sai6855 sai6855 changed the title [material-ui][Modal] Deprecate components, componentProps [material-ui][Modal] migrate useSlotProps to useSLot Jun 1, 2024
@sai6855 sai6855 force-pushed the deprecta-modal-componentprops branch from a327ab1 to 6b8fd4f Compare June 1, 2024 07:58
@@ -44,7 +44,6 @@ describe('<Modal />', () => {
'themeDefaultProps', // portal, can't determine the root
'themeStyleOverrides', // portal, can't determine the root
'reactTestRenderer', // portal https://github.com/facebook/react/issues/11565
'slotPropsCallback', // not supported yet
Copy link
Contributor Author

Choose a reason for hiding this comment

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

proof of slotPropsCallback is working

@sai6855 sai6855 requested a review from DiegoAndai June 1, 2024 11:21
@sai6855 sai6855 marked this pull request as ready for review June 1, 2024 11:21
@sai6855 sai6855 removed the deprecation New deprecation message label Jun 6, 2024
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @sai6855

Comment on lines 159 to 168
const externalForwardedProps = {
slots: {
root: slots.root ?? components.Root,
backdrop: slots.backdrop ?? components.Backdrop,
},
slotProps: {
root: slotProps.root ?? componentsProps.root,
backdrop: backdropSlotProps,
},
};
Copy link
Member

Choose a reason for hiding this comment

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

Could this be?:

Suggested change
const externalForwardedProps = {
slots: {
root: slots.root ?? components.Root,
backdrop: slots.backdrop ?? components.Backdrop,
},
slotProps: {
root: slotProps.root ?? componentsProps.root,
backdrop: backdropSlotProps,
},
};
const externalForwardedProps = {
slots: {
root: components.Root,
backdrop: components.Backdrop,
...slots,
},
slotProps: {
...componentsProps,
...slots
},
};

This would allow us to remove the rootSlotProps and backdropSlotPropsvariables.

Copy link
Contributor Author

@sai6855 sai6855 Jun 10, 2024

Choose a reason for hiding this comment

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

@DiegoAndai refactored in this commit f7a2329, PR is now ready for next review

Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

Thanks for taking this @sai6855

@DiegoAndai DiegoAndai merged commit 2383ded into mui:next Jun 26, 2024
19 checks passed
joserodolfofreitas pushed a commit to joserodolfofreitas/material-ui that referenced this pull request Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: modal This is the name of the generic UI component, not the React module! package: codemod Specific to @mui/codemod package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants