Skip to content

Commit f04613c

Browse files
authored
Merge pull request #2988 from plotly/fix/2983
Fix error handler and grouped outputs
2 parents 354d1a0 + b0acdfa commit f04613c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77
## Fixed
88

99
- [#2987](https://github.com/plotly/dash/pull/2987) Fix multioutput requiring same number of no_update. Fixes [#2986](https://github.com/plotly/dash/issues/2986)
10+
- [2988](https://github.com/plotly/dash/pull/2988) Fix error handler and grouped outputs. Fixes [#2983](https://github.com/plotly/dash/issues/2983)
1011

1112
## Deprecated
1213

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)