set_props only updating last output in background callbacks #3104
Open
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