-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Prevent ownerState
propagation for transition slots
#44401
[material-ui] Prevent ownerState
propagation for transition slots
#44401
Conversation
Netlify deploy previewhttps://deploy-preview-44401--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
ownerState
propagation in accordion transition slotownerState
propagation for transition slots
ownerState
propagation for transition slotsownerState
propagation for transition slots
Co-authored-by: Olivier Tassinari <[email protected]> Signed-off-by: Zeeshan Tamboli <[email protected]>
Hey @ZeeshanTamboli, thanks for working on this. We do want the The fix here should be to filter out the |
Oh, I thought the slotProps={{ transition: ({ expanded }) => (expanded ? 300 : null) }} For non-transition slots, I assumed Is that not the case?
Do we document this somewhere? |
Both of these are useful, but IMO don't cover all use cases. Making the parent's
No. Documentation about slots could and should be much better. We're working on improving that, but first, we want to implement the missing slots throughout the components. |
@DiegoAndai What's your take on the recent pushed change to destructure |
|
@DiegoAndai Just a ping to review this further in case you missed the notification. |
The Collapse transition uses a styled JSX component instead of
Added in Accordion test file because this is the component whose transition child is directly an HTML element and |
Yes, that was the previous solution to this same problem, but I would prefer that it had this PR's implementation, I think it's easier to understand and less fragile. Also, having all transition components be as consistently implemented as possible would be good. |
@DiegoAndai Made the change. |
Thanks @ZeeshanTamboli, looks good. I have one final request. May I ask you to add a regression test for the issue in #40653. We should've added it in #41187. The regression test can be extracted for this example:
The Switch input and text can be removed for the regression test, they're there only for demonstration purposes. Thanks in advance! |
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.
Thanks @ZeeshanTamboli!
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.
Just saw the broken test 😅
Signed-off-by: Diego Andai <[email protected]>
82c4ed8
to
bc48d22
Compare
bc48d22
to
0fc6f3d
Compare
…' of https://github.com/ZeeshanTamboli/material-ui into remove-ownerState-propogation-accordion-transition-slot
…' of https://github.com/ZeeshanTamboli/material-ui into remove-ownerState-propogation-accordion-transition-slot
@DiegoAndai All passing now |
Found this while investigating an issue—check the console error about
ownerState
.Before: Sandbox
After: Sandbox
You can also see it in the local Accordion docs at
http://localhost:3000/material-ui/react-accordion/
.The workaround in #40418 was removed in favor of #41187, but #41187 doesn’t handle custom transition slots like Fade and Zoom.
This PR introduces a new
shouldAppendOwnerState
option inuseSlot
, preventingownerState
from being appended unnecessarily, instead of appending and then removing it.