plotly / dash

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

[BUG] dcc.Dropdown value does not update when an option is removed (regression from #1868) #2733

Closed Thuener closed 3 months ago

Thuener commented 5 months ago

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

Expected behavior

Removing an option from options should also remove that option from value, that way it will be sync with the UI.

Screenshots

Using the same code as #1868 but with version 2.13.0 we have msedge_oxESf4Irhm

TillerBurr commented 3 months ago

I was able to pinpoint the problem to the code https://github.com/plotly/dash/blob/f7f8fb4c5893506e35cdeaec141310a95fe1486a/components/dash-core-components/src/fragments/Dropdown.react.js#L123-L129

In particular, the searchable check is somewhat problematic. Removing it fixes the issue because the dropdown in the example is searchable by default. The reason that it was there to begin with is that without that check, it reintroduces the issue https://github.com/plotly/dash/issues/2099.

I'd have to think about how to properly solve this.