Skip to content

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

Open
@CNFeffery

Description

@CNFeffery
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)

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokenregressionthis used to work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions