If input/state referenced by id
which is dict
, e.g. Input({'type':'whatever', 'index':'foo'}, 'value')
then there is no warning about missing id
when it is not in the layout.
Notice, it is concrete id, not pattern-matching like {index: ALL}
So I’d like to treat this as a feature, but I want to make sure it won’t get fixed/changed.
hi @Val
Welcome to the community and thank you for the question. I’m going to copy the example you shared with me that highlights your case:
from dash import Input, Output, Dash, html
app = Dash(__name__)
app.layout = html.Div([
html.Div('Hi there!', id='out'),
])
@app.callback(
Output('out', 'children'),
# input is not in the layout, but there is no warning
Input(dict(type='qq', index='1'), 'n_clicks'),
)
def tst(n_clicks):
return []
if __name__ == '__main__':
app.run_server(debug=True)
You are right. No error is shown. This is because there is no check on callbacks (with input as dict), as the inputs are dynamic. Therefore, I don’t think this will get “fixed”.