dash icon indicating copy to clipboard operation
dash copied to clipboard

[BUG] running does not support wildcards in ids

Open tlauli opened this issue 1 year ago • 1 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.17.0
dash-core-components                     2.0.0
dash-html-components                     2.0.0
dash-table                               5.0.0
dash-bootstrap-components                1.6.0

Describe the bug

Using wildcards in ids for Outputs in the running kwarg does leads to itempath is undefined error.

Expected behavior

Wildcards are properly resolved and matching components are updated while the callback is running.

MVE

from time import sleep

import dash_bootstrap_components as dbc
from dash import MATCH, Input, Output, callback

layout = [
    dbc.Button(
        "Test1",
        id={"component": "button", "index": "1"},
    ),
    dbc.Button(
        "Test2",
        id={"component": "button", "index": "2"},
    ),
]


@callback(
    Output({"component": "button", "index": MATCH}, "color"),
    Input({"component": "button", "index": MATCH}, "n_clicks"),
    running=[
        (Output({"component": "button", "index": MATCH}, "children"), "running", "finished"),
    ],
    prevent_initial_call=True,
)
def test(_) -> str:
    sleep(3)
    return "warning"

tlauli avatar May 20 '24 14:05 tlauli

The main issue here is that the MATCH doesn't work.

Coding-with-Adam avatar May 21 '24 17:05 Coding-with-Adam