Describe your context
dash 1.7.0
dash-core-components 1.6.0
dash-html-components 1.0.2
dash-renderer 1.2.2
dash-table 4.5.1
Describe the bug
When using multi-outputs in the following code snippet (set MULTI = True), the labels are not reliably updated when clicking the button to update the slider values.
To reproduce:
- Start the app
- Click the button to set both slider values to 5
- Change both slider values manually to a different number. Both labels update correctly
- Click the button again. Only the second label is updated, not the first, despite both
update_slider1_label and update_slider2_label being called
importdashimportdash_html_componentsashtmlimportdash_core_componentsasdccfromdash.dependenciesimportOutput, Inputfromdash.exceptionsimportPreventUpdateAPP=dash.Dash(__name__)
APP.layout=html.Div([
html.Div([
html.Button('Button', id='button'),
]),
html.Div([
html.Label(id='label1'),
dcc.Slider(id='slider1', min=0, max=10, value=0),
]),
html.Div([
html.Label(id='label2'),
dcc.Slider(id='slider2', min=0, max=10, value=0),
])
])
MULTI=TrueifMULTI:
@APP.callback( [Output('slider1', 'value'),Output('slider2', 'value')], [Input('button', 'n_clicks_timestamp')] )defupdate_slider_vals(n_clicks_timestamp):
ifnotn_clicks_timestamp:
raisePreventUpdatereturn5, 5else:
@APP.callback(Output('slider1', 'value'), [Input('button', 'n_clicks_timestamp')] )defupdate_slider1_val(n_clicks_timestamp):
ifnotn_clicks_timestamp:
raisePreventUpdatereturn5@APP.callback(Output('slider2', 'value'), [Input('button', 'n_clicks_timestamp')] )defupdate_slider2_val(n_clicks_timestamp):
ifnotn_clicks_timestamp:
raisePreventUpdatereturn5@APP.callback(Output('label1', 'children'), [Input('slider1', 'value')])defupdate_slider1_label(val):
ret=f'Slider1 value {val}'print(ret)
returnret@APP.callback(Output('label2', 'children'), [Input('slider2', 'value')])defupdate_slider2_label(val):
ret=f'Slider2 value {val}'print(ret)
returnretif__name__=='__main__':
APP.run_server(port=6060)Expected behavior
In this example, both labels should always be updated to reflect the slider value, regardless of whether there is one callback doing both or each label has its own callback.
Screenshots

Describe your context
Describe the bug
When using multi-outputs in the following code snippet (set
MULTI = True), the labels are not reliably updated when clicking the button to update the slider values.To reproduce:
update_slider1_labelandupdate_slider2_labelbeing calledExpected behavior
In this example, both labels should always be updated to reflect the slider value, regardless of whether there is one callback doing both or each label has its own callback.
Screenshots