Skip to content

Commit 87f75d7

Browse files
committed
Fix error handler and grouped outputs
1 parent 354d1a0 commit 87f75d7

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

dash/_callback.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ def add_context(*args, **kwargs):
509509

510510
# If the error returns nothing, automatically puts NoUpdate for response.
511511
if output_value is None:
512-
if not multi:
513-
output_value = NoUpdate()
514-
else:
515-
output_value = [NoUpdate() for _ in output_spec]
512+
output_value = NoUpdate()
516513
else:
517514
raise err
518515

tests/integration/callbacks/test_callback_error.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ def global_callback_error_handler(err):
1010
app.layout = [
1111
html.Button("start", id="start-local"),
1212
html.Button("start-global", id="start-global"),
13+
html.Button("start-grouped", id="start-grouped"),
1314
html.Div(id="output"),
1415
html.Div(id="output-global"),
1516
html.Div(id="error-message"),
17+
# test for #2983
18+
html.Div("default-value", id="grouped-output"),
1619
]
1720

1821
def on_callback_error(err):
@@ -36,6 +39,14 @@ def on_start(_):
3639
def on_start_global(_):
3740
raise Exception("global error")
3841

42+
@app.callback(
43+
output=dict(test=Output("grouped-output", "children")),
44+
inputs=dict(start=Input("start-grouped", "n_clicks")),
45+
prevent_initial_call=True,
46+
)
47+
def on_start_grouped(start=0):
48+
raise Exception("grouped error")
49+
3950
dash_duo.start_server(app)
4051
dash_duo.find_element("#start-local").click()
4152

@@ -44,3 +55,9 @@ def on_start_global(_):
4455

4556
dash_duo.find_element("#start-global").click()
4657
dash_duo.wait_for_text_to_equal("#output-global", "global: global error")
58+
59+
dash_duo.find_element("#start-grouped").click()
60+
dash_duo.wait_for_text_to_equal("#output-global", "global: grouped error")
61+
dash_duo.wait_for_text_to_equal("#grouped-output", "default-value")
62+
63+
assert dash_duo.get_logs() == []

0 commit comments

Comments
 (0)