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] Return instance and publicAPI methods from plugin and populate the main objects inside useTreeView #12650

Merged
merged 6 commits into from Apr 8, 2024

Conversation

flaviendelangle
Copy link
Member

This is a proposal for a DX change on the plugin API.
Right now, we are populating the instance and publicAPI objects inside each plugin using the populateInstance and populatePublicAPI methods.
This PR proposes to instead have the plugin returning them and useTreeView do the population.

Advantages

  • More consistent with the contextValue which is returned by each plugin
  • Allows to have a type error when a plugin forgets to populate its instance or publicAPI
  • Plugin that never consume the instance no longer need to access this parameter
  • The publicAPI parameter can be totally removed from the plugin parameters

@mui-bot
Copy link

mui-bot commented Apr 3, 2024

@flaviendelangle flaviendelangle self-assigned this Apr 3, 2024
@flaviendelangle flaviendelangle added the component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! label Apr 3, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 3, 2024
Copy link
Contributor

@noraleonte noraleonte left a comment

Choose a reason for hiding this comment

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

Very interesting change 👏 It makes total sense!

@flaviendelangle flaviendelangle merged commit e3f6d43 into mui:master Apr 8, 2024
15 checks passed
@flaviendelangle flaviendelangle deleted the remove-populate-methods branch April 8, 2024 12:09
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.

None yet

3 participants