Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
Thuener opened this issue Jan 29, 2024 · 1 comment · Fixed by #2816
Closed
Labels
bug something broken regression this used to work sev-2 serious problem

Comments

@Thuener
Copy link

Thuener commented Jan 29, 2024

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

  • replace the result of pip list | grep dash below
dash                 2.13.0

Describe the bug
Regression #1868
When the options of a dcc.Dropdown are updated to remove a currently selected option, the UI updates to remove that value, but the value parameter does not update.

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

@Coding-with-Adam Coding-with-Adam added the bug something broken label Jan 30, 2024
@alexcjohnson alexcjohnson added regression this used to work sev-2 serious problem labels Feb 1, 2024
@TillerBurr
Copy link
Contributor

TillerBurr commented Mar 26, 2024

I was able to pinpoint the problem to the code

useEffect(() => {
if (
!searchable &&
!isNil(sanitizedOptions) &&
optionsCheck !== sanitizedOptions &&
!isNil(value)
) {

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 #2099.

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug something broken regression this used to work sev-2 serious problem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants