Uh oh!
There was an error while loading. Please reload this page.
fix: flatten outputs before building loadingOutputs - #3641
Conversation
AnnMarieW
commented
Mar 11, 2026
Thanks for the fix @i-murray I tried your sample app after the fix and verified that it works. Here is a simplified version that can be added as a test in this file: https://github.com/plotly/dash/blob/dev/components/dash-core-components/tests/integration/loading/test_loading_component.py deftest_ldcp019_loading_component_pattern_matching(dash_dcc):
lock=Lock()
app=Dash(__name__)
app.layout=html.Div(
[dcc.Loading([html.Div(id={"type": "div-1", "index": 1, "name": "test"}, className="div-1")], className="loading")],
id={"type": "root", "index": 1, "name": "test"},
className="root"
)
@app.callback(Output({"type": "div-1", "index": ALL, "name": MATCH}, "children"), Input({"type": "root", "index": ALL, "name": MATCH}, "n_clicks"))defupdateDiv(n_clicks):
ifn_clicks== [1]:
time.sleep(.1)
return ["changed"]
return ["content"]
withlock:
dash_dcc.start_server(app)
dash_dcc.wait_for_text_to_equal(".div-1", "content")
dash_dcc.find_element(".root").click()
dash_dcc.find_element(".loading .dash-spinner")
# mounted but hidden, so looks like no textdash_dcc.wait_for_text_to_equal(".div-1", "")
dash_dcc.wait_for_text_to_equal(".div-1", "changed")
assertdash_dcc.get_logs() == []
|
AnnMarieW
commented
Mar 17, 2026
@T4rk1n This is ready for review - I ran the new test locally, but I don't think I can add it to the PR since I'm not a maintainer. |
Add test_ldcp019_loading_component_pattern_matching to verify that dcc.Loading spinner triggers correctly when callback Output uses the ALL wildcard with pattern-matching IDs.
i-murray
commented
Mar 17, 2026
@AnnMarieW, thank you for writing the test for this fix. I've added it. |
T4rk1n
left a comment
There was a problem hiding this comment.
💃 Looks good, just need to run npm run format to pass the linting.
ndrezn
commented
Mar 18, 2026
Thanks for the contribution @i-murray ! |
i-murray
commented
Mar 25, 2026
@T4rk1n linting should pass now. There was also a duplicate test function name I fixed as well. |
The test_ldcp010_loading_component_target_components test used an ID selector built from stringify_id(...), but this contains special characters that are not safe in a CSS #id selector. Now switched to an attribute selector form so Selenium can find the element. This surfaced after duplicate test names were resolved in a previous commit, which allowed this test to run and expose the selector issue.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fix
dcc.Loadingspinner not triggering when a callbackOutputuses theALLwildcard.Problem
In
dash-renderer/src/actions/callbacks.ts,loadingOutputswas built withoutputs.map(...). When the output spec containsALL,unwrapIfNotMultireturns resolved outputs as a nested array. Iterating with.map()over this nested structure meantout.idwasundefined, sogetPathreturnedundefinedand the loading reducer never matched the component path.Fix
Changed
outputs.map(...)toflatten(outputs).map(...)on L794, consistent with how outputs are already flattened on L829 and L912 in the same function.Fixes#3619