-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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] Changing dcc.Checklist.options
triggers callbacks with inputs dcc.Checklist.value
#2411
Comments
Thanks @mclarty3 - to my eye there are two bugs here:
Minimum app to reproduce both of these:
from dash import Dash, dcc, html, Input, Output
app = Dash(__name__)
app.layout = html.Div([
html.Button("3<->2", id="a"),
dcc.Checklist(id="b"),
html.Div(id="c")
])
@app.callback(Output('b', 'options'), Input('a', 'n_clicks'))
def opts(n):
n_out = 3 - (n or 0) % 2
return [str(i) for i in range(n_out)]
@app.callback(Output('c','children'), Input('b','value'))
def fin(val):
print(val)
return val
if __name__ == '__main__':
app.run(debug=True) |
Thanks for the thoughtful response and the simpler example app. Funnily I had considered the second bug a feature, as my use-case is similar to the example app I provided, in that I'm filtering out options to allow the user to search within the checklist. That said, if that behavior is "fixed" I'm sure it'd be doable to recreate that functionality some other way. |
Might be able to hide the filtered-out options with some sort of CSS trick… or we could add a feature to continue listing all the options but mark some as hidden. But yeah, definitely counts as a bug 😄 |
Testing your minimal app @alexcjohnson, it looks like this regression was actually introduced in 2.7.1. Looking at CHANGELOG.md, I wonder if it might be associated with #2344, which was a fix for a bug relating to dependent callbacks. |
@T4rk1n would you be able to look at this one as well after partial props? |
Describe your context
Please provide us your environment, so we can easily reproduce the issue.
Note that this also occurs with Dash 2.8.0, but not 2.7.0.
if frontend related, tell us your Browser, Version and OS
Describe the bug
When outputting to the
options
property of adcc.Checklist
, it triggers callbacks with inputsdcc.Checklist.value
.Expected behavior
Callbacks with input
dcc.Checklist.value
should only be triggered if that checklist's value is explicitly changed (either through callback or user input), not if only the checklist options are changed.Minimal reproducible example
I've tried to create a simple example app to show exactly what the issue is. I tried taking a screen recording though unfortunately Ubuntu is not helping out currently.
In essence, when running with Dash <= 2.7.0, only selecting/deselecting a city should increment the counter below the checklist. With Dash >= 2.8.0, however, the counter is also incremented when typing in the search bar above the checklist (not desired behaviour)
DashBugMRE.zip
The text was updated successfully, but these errors were encountered: