Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_props only updating last output in background callbacks #3104

Open
faulty13 opened this issue Dec 11, 2024 · 0 comments
Open

set_props only updating last output in background callbacks #3104

faulty13 opened this issue Dec 11, 2024 · 0 comments
Labels
bug something broken P3 backlog

Comments

@faulty13
Copy link

faulty13 commented Dec 11, 2024

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.
Image

@gvwilson gvwilson added bug something broken P3 backlog labels Dec 12, 2024
@gvwilson gvwilson changed the title [BUG] set_props only updating last output in background callbacks set_props only updating last output in background callbacks Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants