dash icon indicating copy to clipboard operation
dash copied to clipboard

Patten matching callbacks do not warn if no matches exist

Open farhanhubble opened this issue 5 months ago • 0 comments

Describe your context Please provide us your environment, so we can easily reproduce the issue.

  • replace the result of pip list | grep dash below
dash                                     2.18.1         A Python framework ...
dash-bootstrap-components                1.6.0          Bootstrap themed co...
dash-core-components                     2.0.0          Core component suit...
dash-html-components                     2.0.0          Vanilla HTML compon...
dash-table                               5.0.0          Dash table

Describe the bug

When registering a pattern-matching callback, no warning is issued if the pattern does not match the ID of any of the DOM elements. For example if we create a button with an ID like this:

id={
	"type": "delete-list-item",
	"deletion-target": "some_path",
        "extras":  "..."
}

and then define a callback that only defines 2/3 of the keys present in the id dict:

@app.callback(
    Input(
        {"type": "delete-list-item", "deletion-target": "some_path", }, "n_clicks"
    ),
)
def delete_list_item(n_clicks):
    print(n_clicks)

The callback does not get attached to any element but does show up on the dev tools page.

Expected behavior

Under the default conditions (app.config.suppress_callback_exceptions = False), a warning should be emitted when no matching ids are found.

Screenshots

Not needed

farhanhubble avatar Sep 19 '24 02:09 farhanhubble