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

[BUG] set_props called multiple times only keep the last props. #2852

Closed
T4rk1n opened this issue May 7, 2024 · 0 comments · Fixed by #2856
Closed

[BUG] set_props called multiple times only keep the last props. #2852

T4rk1n opened this issue May 7, 2024 · 0 comments · Fixed by #2856

Comments

@T4rk1n
Copy link
Contributor

T4rk1n commented May 7, 2024

For regular callbacks, when multiple call of set_props to the same component id, only the last call is saved.

Example:

from dash import Dash, Input, html, set_props

app = Dash()

app.layout = [
    html.Button("start", id="start"),
    html.Div("initial", id="output"),
]

@app.callback(
    Input("start", "n_clicks"),
)
def on_click(_):
    set_props("output", {"children": "changed"})
    set_props("output", {"style": {"background": "red"}})

if __name__ == "__main__":
    app.run(debug=True)

Clicking on the start button only set the background red, the text stays at "initial". The props should be merged and both updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants