Black Lives Matter. Please consider donating to Black Girls Code today.

Default dropdown values when options are modified

Hi Dash Community,

I have a question I have been struggling with today regarding the behavior of residual dropdown values after options have been modified.

Consider 3 dropdowns used to generate a graph from some data:

Dropdown 1: Selection of years
[2015, 2016, 2017, 2018, 2019]

Dropdown 2: Selection of companies based on Dropdown 1:
[if 2015: Company A, B, C]
[if 2017: Company A, B, C, D, E]

Dropdown 3: Pull out a slice of a pie chart
[Slice 1, Slice 2, etc.]

If company E is selected, and the year is changed from 2017 to 2015, the graph disappears as intended,
the selection appears cleared, and Dropdown 2 options are updated.

However, if company E is selected while there is a value in Dropdown 3, and the year is changed to 2015,
the value that appeared cleared causes an error as there is no data for that criteria.

Is there a way to set the value of Dropdown 2 to something like none type in this scenario?
The condition could be that it is not found in the dropdown.

I cannot change the value of Dropdown 2 explicitly as it is one of my input values,
and you cannot have the same input and output.

Thank you