[internal] Fix proptypes generation when multiple components per file#44058
[internal] Fix proptypes generation when multiple components per file#44058Janpot merged 7 commits intomui:masterfrom
Conversation
Netlify deploy previewhttps://deploy-preview-44058--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
|
The newly added proptypes don't add any value as they annotate internal components (and they duplicate what's already there in public components). We should add |
Doesn't this flag work on a per-file basis? These files also contain a public component as far as I understand. |
|
Right, in this case, it sucks :/ |
|
Didn't want to waste too much time on it and assumed it was better to rather have those proptypes there than the bug, even though it's at least 4 years old. |
|
After this change, we are facing problems on mui/mui-x#14937. Any ideas on how to proceed with the mentioned PR? 🤔 |
|
🤔 As far as I understand
I remember trying this PR out on X, didn't see changes, I must have messed up. |
Ok, let's go with this approach. 👌 |
Reviewing proptypes generation code for mui/mui-public#209, I noticed this bug. original proptypes were replaced without checking for multiple instances in the file. I'm replacing the single
originalPropTypesPathwith a map that maps each component to its ownoriginalPropTypesPath.This generated some new proptypes for two memoized components, which doesn't support a
.propTypesproperty, this lead to build errors. I assign the inner components to intermediate variables to solve those.It looks like there's a similar thing going on with
previousPropTypesSourceas well, applied the same fix, which didn't result in any changes.