dash icon indicating copy to clipboard operation
dash copied to clipboard

Callbacks with no output and pattern MATCH not allowing dash to run

Open micmizer opened this issue 1 year ago • 1 comments
trafficstars

Using a callback with no output in Dash 2.17.1 and using a MATCH pattern on the input from a data table prevents dash from loading.

Describe your context Create a simple single file app with a data table and a pattern matching callback with no output.

This works:

@callback(
    Input({'type': 'data-table', 'index': ALL}, 'active_cell'),
    State('url', 'pathname'),
)
def print_table_id_and_column(active_cell, pathname):
    print("hello")

This however causes the app to not load at all. The only indication of an issue is in the browser console. screenshot provided below:

@callback(
    Input({'type': 'data-table', 'index': MATCH}, 'active_cell'),
    State('url', 'pathname'),
)
def print_table_id_and_column(active_cell, pathname):
    print("hello")

Environment:

pip list | grep dash
dash                      2.17.1
dash-bootstrap-components 1.5.0
dash-bootstrap-templates  1.1.2
dash-core-components      2.0.0
dash-extensions           1.0.14
dash-html-components      2.0.0
dash-iconify              0.1.2
dash_mantine_components   0.14.4
dash-table                5.0.0

Describe the bug

Uncaught error TypeError: Cannot read properties of undefined (reading 'id') prevents dash from running.

Expected behavior

I expect that using a callback with no output works with both ALL and MATCH pattern matching.

Screenshots

image

micmizer avatar Aug 08 '24 18:08 micmizer

This is the same issue as in #2462. Dash requires that if you use MATCH in the input, it should also appear in the output. The referenced issue also requested this restriction to be removed now that we can have callbacks with duplicate outputs. No idea, where on the roadmap this issue is.

aGitForEveryone avatar Aug 30 '24 07:08 aGitForEveryone

Been running into this issue as well

BSd3v avatar Aug 19 '25 09:08 BSd3v