plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.54k stars 2.08k forks source link

add prop types to tsx components #3035

Closed T4rk1n closed 1 week ago

T4rk1n commented 1 month ago

Fix #3014

We use the propTypes defined on the react components to provide runtime prop validation on dash components. This property is missing from typescript components as they don't define that attribute, this PR generate propTypes for the components using the extracted metadata and saves it in a proptypes.js in the package directory. This file should be added as a dev dependencies in the package __init__.py _js_dist like this:

_js_dist = [
...,
"dev_package_path": "proptypes.js",
"namespace": "package"
]
alexcjohnson commented 1 month ago

Ah ok - so after that can we remove metadata.json from the packages entierly?

T4rk1n commented 1 month ago

Ah ok - so after that can we remove metadata.json from the packages entierly?

It hasn't been needed since the components are generated in files, think it was only kept around in the libraries after for compatibilities with older version. The runtime component loader will be removed too. There might be some usage with docs.

gvwilson commented 4 weeks ago

@T4rk1n do you want this one in the release or save it for after?

T4rk1n commented 3 weeks ago

Yes this shouldl go into dash 3.0 since it requires components dev to regenerate it would go at the same as the typing generation.