Skip to content

Commit dad46cc

Browse files
committed
🔨 Include value in triggered input list.
1 parent ef420a4 commit dad46cc

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: dash/dash.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,19 @@ def dispatch(self):
950950
target_id = '{}.{}'.format(output['id'], output['property'])
951951
args = []
952952

953-
flask.g.input_values = {
953+
flask.g.input_values = input_values = {
954954
'{}.{}'.format(x['id'], x['property']): x.get('value')
955955
for x in inputs
956956
}
957957
flask.g.state_values = {
958958
'{}.{}'.format(x['id'], x['property']): x.get('value')
959959
for x in state
960960
}
961-
flask.g.triggered_inputs = body.get('changedPropIds')
961+
changed_props = body.get('changedPropIds')
962+
flask.g.triggered_inputs = [
963+
{'prop_id': x, 'value': input_values[x]}
964+
for x in changed_props
965+
] if changed_props else []
962966

963967
for component_registration in self.callback_map[target_id]['inputs']:
964968
args.append([

Diff for: tests/test_integration.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,8 @@ def on_click(*args):
592592
if not dash.callback_context.triggered:
593593
raise PreventUpdate
594594
trigger = dash.callback_context.triggered[0]
595-
input_value = dash.callback_context.inputs.get(trigger)
596595
return 'Just clicked {} for the {} time!'.format(
597-
trigger.split('.')[0], input_value
596+
trigger['prop_id'].split('.')[0], trigger['value']
598597
)
599598

600599
self.startServer(app)
@@ -603,7 +602,7 @@ def on_click(*args):
603602
self.wait_for_element_by_id(x) for x in btns
604603
]
605604

606-
for i in range(1, 10):
605+
for i in range(1, 5):
607606
for j, btn in enumerate(btns):
608607
btn_elements[j].click()
609608
self.wait_for_text_to_equal(

0 commit comments

Comments
 (0)