Skip to content

[BUG] Components added through set_props() cannot trigger related callback functions. #3316

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

Open
CNFeffery opened this issue May 29, 2025 · 1 comment

Comments

@CNFeffery
Copy link
Contributor

dash                 3.0.4

Example application:

Image

import dash
from dash import html, set_props
from dash.dependencies import Input, Output

app = dash.Dash(__name__, suppress_callback_exceptions=True)

app.layout = html.Div(
    [
        html.Button("origin button", id="origin-button"),
        html.Div(id="generated-button-container"),
        html.Div("initial text", id="generated-button-output"),
    ],
    style={"padding": 50},
)


@app.callback(
    Input("origin-button", "n_clicks"),
)
def generate_button(n_clicks):
    set_props(
        "generated-button-container",
        {"children": html.Button("generated button", id="generated-button")},
    )


@app.callback(
    Output("generated-button-output", "children"),
    Input("generated-button", "n_clicks"),
    prevent_initial_call=True,
)
def update_output(n_clicks):
    return f"n_clicks: {n_clicks}"


if __name__ == "__main__":
    app.run(debug=True)
@BSd3v
Copy link
Contributor

BSd3v commented May 29, 2025

@T4rk1n,

It looks like the dash store isnt receiving the path, with allow_optional=True it still triggers the callback, but the value is never received though the component itself sees n_clicks as increasing.

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

No branches or pull requests

2 participants