Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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][Button] Add loading feature to Button #42987
[material-ui][Button] Add loading feature to Button #42987
Changes from 16 commits
7f2f33a
aa09045
7369f21
4459f08
451a3a1
4ddca3f
a9cac91
f045e16
e77cc6f
6379283
6402d77
56449f4
5186aa9
293ecdc
a3f279c
5b429c6
8b968cf
0de62ae
ae5befd
15c0396
1d6b23f
9c1394d
54acce4
840c0a8
64f6e6f
a837207
e9d2f9d
eea3660
c983657
1793b93
cf13fb0
0a368a4
3bc8275
110316c
a3821e0
f09c729
4099c08
91c8f50
1563d53
d0d914a
6b0ce5d
eceba5d
18ef354
839d9c7
b52d663
65f25fd
b2dc46e
2864248
75f35f9
23d8200
ae62a4d
d0f92dd
a354fd5
497b8ad
c24da44
d160f4c
10c8fd8
d7b67b5
158a325
3f800e0
d0ce7f3
ad5e9c7
739299b
e6ad5c1
723d36d
0de27c4
b472bb9
579e331
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This change goes in opposition to the initial API design decision, no? #21389. We used
import LoadingButton from '@mui/lab/LoadingButton';
, we didn't use:The reason was in this dangerbot message:
Personally, as a user, I wouldn't want to use the Material UI Button if it loads a progress component that is different from the one that I want to use because it's bundle size bloat.
Was this change discussed? How do we feel about it?
Happy to move forward with a
loading
prop though.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 a
<Button loading>
is better than having<Button>
and<LoadingButton>
. I guess 9/10 projects would need a loading button so it's fine to bundleCircularProgress
to theButton
.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, this was discussed. Having a
loading
prop in Button is universally established and I think it's preferable to mergeLoadingButton
andButton
to reduce API surface and confusion (why having 2 components with almost the same exact API?), even if it means an increase in the bundle size.Q: Is there a way we could dynamically import the progress component that would be compatible with all bundlers? Are dynamic imports universally supported?
This also happens with component styles. Users load our components, which have all styles built-in and are included in the bundle, to later override them.
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.
@aarongarciah MUI X does this https://github.com/mui/mui-x/blob/a4481b6a661849d1a33b41aad86970a1e212ca69/packages/x-data-grid-premium/src/hooks/features/export/serializer/excelSerializer.ts#L24. It seems to work for them:
Screen.Recording.2024-11-19.at.16.34.51.mov
In the CJS the output is https://unpkg.com/browse/@mui/x-data-grid-premium@7.22.2/hooks/features/export/serializer/excelSerializer.js so it only works for ESM.
This wouldn't work for us here, since we would also need an async component, not React 18 friendly.
Yeah. Ok, so maybe it's fine. As long as we move to have the source to be clean to copy and paste from the npm package to a project codebase, then, a developer (e.g. me) would eject, and remove all the stuff unneeded, once it truly becomes a problem.
I have checked a couple of design system, they seem to all go with the loading prop pattern. e.g. https://polaris.shopify.com/components/actions/button. So yeah, assuming that we don't expect most people to wrap the MUI component to create their own system, but to either