Skip to content
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

[TreeView] Support experimental features from plugin's dependencies #13632

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

flaviendelangle
Copy link
Member

While working on #13520, I noticed that if a plugin had an experimental feature and one of its dependencies also had an experimental feature, then the typing broke.

The reason is that calling MergeSignaturesProperty on a union did not work (we ended up with 'virtualization' & 'indentationPerLevel' instead of 'virtualization' | 'indentationPerLevel'.
I changed the logic to instead transform the experimental features into an object inside TreeViewPluginSignature to keep all the merging strategies consistent.

@flaviendelangle flaviendelangle added the component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! label Jun 26, 2024
@flaviendelangle flaviendelangle self-assigned this Jun 26, 2024
@@ -38,4 +38,5 @@ export type TreeViewPublicAPI<

export type TreeViewExperimentalFeatures<
TSignatures extends readonly TreeViewAnyPluginSignature[],
> = { [key in MergeSignaturesProperty<TSignatures, 'experimentalFeatures'>]?: boolean };
TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = [],
> = MergeSignaturesProperty<[...TSignatures, ...TOptionalSignatures], 'experimentalFeatures'>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added support for the optional plugins even if we never use it for now, just to be consistent with the instance and params

@mui-bot
Copy link

mui-bot commented Jun 26, 2024

Deploy preview: https://deploy-preview-13632--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against f453fca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants