-
-
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
[lab][LoadingButton] LoadingButton now inherits props from ButtonGroup #39679
[lab][LoadingButton] LoadingButton now inherits props from ButtonGroup #39679
Conversation
Netlify deploy preview@material-ui/lab: parsed: +0.42% , gzip: +0.35% Bundle size reportDetails of bundle changes (Toolpad) |
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.
We should add tests, and I also suggest adding documentation that demonstrates Loading Buttons inside ButtonGroup.
@ZeeshanTamboli do you think its better to place the documentation at the ButtonGroup or the Button page? And what tests did you have in mind? And another question: Why is the LoadingButton actually in |
@lhilgert9, let's start by questioning whether we truly need this feature. Issue #34415 has been open for a year without any requests or upvotes. Since you've created the PR, can you clarify your specific use case for it? Implementing this feature will increase maintenance overhead. |
@ZeeshanTamboli, I personally use the ButtonGroup very often in my projects and also the LoadingButton to show the status of a server request. So far I have to manually pass the stylings of the ButtonGroup to the LoadingButton every time. I think that this issue #34415 doesn't have so many upvotes, because you can fix the bug quite easily by adding the stylings manually. But I think this small change will save a lot of work in the future. |
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.
The changes make sense to me 👍 Let's add a test in the LoadinButton
component that will verify that if it is used in a ButtonGroup it will inherit the props passed from this component. Also, let's include update one of the button group demos to show a loading button.
@mnajdova I've added two tests and a demo to the docs. Preview: https://deploy-preview-39679--material-ui.netlify.app/material-ui/react-button-group/#loading-button |
docs/data/material/components/button-group/LoadingButtonGroup.tsx
Outdated
Show resolved
Hide resolved
@mnajdova What about this PR? I had actually fixed all the errors or had I forgotten something? |
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.
Looks good, left one final comment.
Co-authored-by: Marija Najdova <mnajdova@gmail.com> Signed-off-by: Lucas Hilgert <77863078+lhilgert9@users.noreply.github.com>
@mnajdova Okay, I have fixed that. Should be ready to merge now👍🏽. |
Not sure why CI is failing. Will try again later. |
@ZeeshanTamboli It looks like the error is the same as here, because in my last commit the node version which is used for CI is 18.18.0: https://github.com/mui/material-ui/actions/runs/6943811139/job/18889666611?pr=39679 and in your current commit it uses 18.19.0: https://github.com/mui/material-ui/actions/runs/7141802378/job/19472684424?pr=39679. (You can see the used Node version when clicking I opened #40173 to better talk about the error |
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.
Shouldn't this have been accompanied by a peer dependency version bump for |
I see, but what would be the advantage? |
Well, in my opinion if the package is going to specify a minimum peer dependency version at all it might as well be a correct one. It would've saved me a minor headache yesterday when I went to upgrade the lab package after dependabot suggested doing so. It did not suggest upgrading I resolved the issue by upgrading to v5.15.0 after a brief investigation. |
I agree with you. @mnajdova Maybe we should take a look at this for future releases. |
Coming a bit late to the conversation, but that was a good observation @milotoor , we should update the peer dependency, if we haven't already. @ZeeshanTamboli could you take a look at this? |
Breaking change label added, it was one. |
Closes #34415 by using the ButtonGroupContext in the LoadingButton. It works like in the normal Button.