Skip to content

metadata.json and props generating extra quotes for enum types #3266

@Georgegriff

Description

@Georgegriff

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context
Please provide us your environment, so we can easily reproduce the issue.

I've followed this template and got it working https://github.com/plotly/dash-typescript-component-template

Describe the bug

However when i wrap one of our typescript components, e.g. out button which has this prop:

type = {
variant: "primary" | "secondary" | "tertiary"
}

Then metadata.json and propTypes it generates are wrong:

  "value": [
            { "value": "'primary'", "computed": false },
            { "value": "'secondary'", "computed": false },
            { "value": "'tertiary'", "computed": false }
          ],

they have an extra quote around them

i guess under the hood its using this https://github.com/plotly/dash/blob/dev/dash/development/_generate_prop_types.py and using the metadata.json as source of truth, which i'm not sure where is coming from maybe react-docgen,

perhaps _generate_prop_types.py should strip out extra quotes of enums before writing the proptypes code?

def generate_enum(prop_info):

Expected behavior
Type enum's should not have extra quotes generated
Screenshots

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions