communitiesuk / gov-uk-dash-react-components

GovUK React components for Dash - GDS. This also includes autocomplete
Other
9 stars 1 forks source link

Fix source not being populated on component updates #3

Closed chopkinsmade closed 2 years ago

chopkinsmade commented 2 years ago

If you set the source property in the component like the below the dropdown would contain the values provided in the source property as expected:

uk_gov_dash_components.Dropdown(
        label="Comparison",
        id='comparison',
        source=["Something", "Something Else"],
        style={"minWidth": "50%"}
    )

image

However when using the dash @app.callback logic and changing the source property, the change in value was not being passed down to the underlying component. The reason for this is the props are being stored in state in the Dropdown but never refreshed after the initial load

chopkinsmade commented 2 years ago

I'm not very clear how this solves the issue I'm afraid.

Surely source was being provided previously anyway?

I've updated the PR description with a more detailed explanation