plotly / plotly/dash

Metadata not generated correctly for Typescript components

Open
#3,017 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

With TypeScript components, the metadata.json file is not generated correctly in cases where there is a union with a boolean.

For example,

persistence?: boolean | string | number;

The metadata.json file only includes the string and number but not the boolean.

 "persistence": {
        "description": "Used to allow user interactions in this component to be persisted when\nthe component - or the page - is refreshed. If `persisted` is truthy and\nhasn't changed from its previous value, a `value` that the user has\nchanged while using the app will keep that change, as long as\nthe new `value` also matches what was given originally.\nUsed in conjunction with `persistence_type`.",
        "required": false,
        "type": {
          "name": "union",
          "value": [
            {
              "name": "string",
              "raw": "string"
            },
            {
              "name": "number",
              "raw": "number"
            }
          ],
          "raw": "string | number | boolean"
        }
      },


The docstrings are not generated correctly:

image

Also, setting the persistence=True on the component generates this warning in the console:

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how metadata.json is generated for TypeScript component props, using the persistence?: boolean | string | number example to reproduce the issue. Done means the generated union retains boolean, the component docstrings reflect it, and setting persistence=True no longer produces the reported warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.