set_props only updating last output in background callbacks
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Describe your context
Mac OS, occurring in Safari & Chrome
dash 2.18.2
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
Describe the bug
When updating two different components via set_props, in a background callback with running, only the last output is updated. No console errors encountered.
Further testing:
- If I remove the background, and running, then both outputs are updated as expected.
- The issue persists if I replace running with cancel.
- If I swap the order of the set_props lines, the other component updates instead.
See reproducible example below:
from dash import Dash, Output, Input, html, set_props, DiskcacheManager
import diskcache
import dash
cache = diskcache.Cache("./cache")
background_callback_manager = DiskcacheManager(cache)
app = Dash()
app.layout = [
html.Button("start", id="start"),
html.Div("initial", id="output"),
html.Div("initial 2", id="output-2"),
]
@app.callback(
Input("start", "n_clicks"),
background=True,
running=[
(Output("start", "disabled"), True, False)
],
manager=background_callback_manager,
)
def on_click(_):
set_props("output", {"children": "changed"})
set_props("output-2", {"style": {"background": "red"}})
if __name__ == "__main__":
app.run(debug=True)
Expected behavior
All outputs should update, not just the last one.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the set_props calls in the provided background callback reproduction and compare behavior with background, running, and cancel enabled or removed. Trace how callback outputs are collected, and consider the issue done when both output and output-2 update reliably in the reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100