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

Limit generated components to 250 explicit args by default #2029

Merged
merged 5 commits into from
Apr 28, 2022

Conversation

alexcjohnson
Copy link
Collaborator

@alexcjohnson alexcjohnson commented Apr 28, 2022

configurable to any other number

Keep this to 253 or below for Py3.6 support. Props beyond those explicitly listed can still be used, they must just be invoked as kwargs. Also I believe that in Py3.6 it will still not be possible to use ALL props of a component if there are >253 - it's not just the function signature that's limited but also any individual function call. That's not a big deal, app developers want access to all of these props but they're very unlikely to actually use them all simultaneously. But it's possible that we'll want to set the limit lower than 250, in case the limit is (total # of named props) + (total unnamed props used simultaneously) - this I haven't tested.

In general, if you get up to hundreds of props in your component, it's a sign that you might want to refactor... group some of them together to make them easier to learn and work with, for example. But there are cases you want more - this PR is prompted by dash-ag-grid where we're wrapping another component (ag-grid) that exposes 265 props, and we're just forwarding them on to dash.

  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR
  • I have added entry in the CHANGELOG.md

configurable to any other number
Keep this to 253 or below for Py3.6 support
@alexcjohnson alexcjohnson requested a review from T4rk1n April 28, 2022 15:25
Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

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

💃 Looks good.

docstring += (
"\n\nNote: due to the large number of props for this component,"
"\nnot all of them appear in the constructor signature, but"
"\nthey may still be used as keyword arguments."
Copy link
Contributor

Choose a reason for hiding this comment

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

The newline at the beginning is kinda weird, it would be more readable to put them at the end of the line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point - especially \nnot looks weird. I did this because I needed some newlines at the start of the string, but better to put those on their own and the others at the end of their lines -> b43044d

@alexcjohnson alexcjohnson merged commit 07be9e2 into dev Apr 28, 2022
@alexcjohnson alexcjohnson deleted the limit-component-args branch April 28, 2022 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants