-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[base] Remove unstyled suffix from Base components + Codemod script #36873
Conversation
Netlify deploy preview
@material-ui/core: parsed: +0.10% , gzip: +0.06% Bundle size report |
0f9e9fc
to
93ef82e
Compare
93ef82e
to
4ef2b4c
Compare
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.
Without renaming the folders in the packages/mui-base/src
everything is broken, as the imports are not updated from '@mui/base/ButtonUnstyledto
@mui/base/Button, while the folder would still be named
ButtonUnstyled`.
packages/mui-codemod/src/v5.0.0/base-remove-unstyled-suffix.test/actual.js
Show resolved
Hide resolved
3dcf0d0
to
9ed3c1b
Compare
cc46fac
to
f82f860
Compare
The failing test is related to #36936 (it's one of the problems that is solved). |
4bcdd3e
to
545b051
Compare
On the codemod, I would expect that interface and other exported modules, like classes etc. that are renamed would be aliased as the old ones, or we should replace them in the whole file, for e.g. import ButtonUnstyled, {
- ButtonUnstyledProps,
+ ButtonProps as ButtonUnstyledProps,
- ButtonUnstyledRootSlotProps,
+ ButtonRootSlotProps as as ButtonUnstyledRootSlotProps,,
- buttonUnstyledClasses,
+ buttonClasses as buttonUnstyledClasses,
-} from '@mui/base/ButtonUnstyled';
+} from '@mui/base/Button'; We should also add test if some of these is already aliased before the codemod. |
The logic in
Update: This was used when the Material UI components were inheriting from the unstyled components, however they are now moved to use the hooks, we can drop this logic altogether. Probably would be better if we isolate this change in a new PR. |
d5ad501
to
097e9e5
Compare
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 codmod updates look great 👌
@siriwatknp or @Janpot maybe you can help. We are removing the It is not that big a deal, as these old URLs were there for only two weeks, we can likely drop this logic after some time, but it bugs me a lot. cc @oliviertassinari it was only two weeks and we had to become creative to fix a redirects with the anchors :) |
@mnajdova Maybe try if (router.isReady && anchor && anchor.endsWith('-unstyled')) { From https://nextjs.org/docs/advanced-features/automatic-static-optimization#caveats
To add a small nit that I noticed I'd also do hash: `${anchor.slice(0, -'-unstyled'.length)}`, To avoid replacing the string |
Aaaah yes, this was it, thanks Jan!
Actually I needed to keep the replacement of the |
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 can't spot anything else, we should be ready for merge 👍
I have found a regression.
Can we solve this as a high priority? There are 20 links like this that point developers to the wrong place. Source. Thanks To be fair, I doubt that this PR is the root of the problem, but just a change that makes is more obvious. While this link wasn't broken before, the first that I can find broken starts from #35938. |
This is a breaking change, while it may be acceptable as |
This is caused by mui/material-ui#36873. Signed-off-by: tison <[email protected]>
|
Preview: e.g., https://deploy-preview-36873--material-ui.netlify.app/base/react-button/