plotly / plotly/dash

Patten matching callbacks do not warn if no matches exist

Open
#3,007 0 comments 0 reactions 1 assignee View on GitHub

@T4rk1n is already working on this.

Since Sep 23, 2024.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.