-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
dash 1.11 suppresses unrelated callbacks on component-load if ReferenceError detected #1200
Comments
Here's what I thought made most sense as the rule to enforce: If:
Then:
What I notice now is that this isn't precisely what happens in dash 1.10, or at least it has more nuance: as to that final point, the "other callbacks" that flow from the callback with missing inputs, they will only fire with at least one other input in addition to the blocked one. To make this concrete: import dash
import dash_html_components as html
from dash.dependencies import Input, Output, State
app = dash.Dash(__name__, suppress_callback_exceptions=True)
app.layout = html.Div(children=[
html.Button("Click", id="btn"),
html.Div("Title", id="title"),
html.Div(id="content"),
html.Div("Output1", id="output1"),
html.Div("No out2 call yet", id="output2")
])
@app.callback(Output("content", "children"), [Input("btn", "n_clicks")])
def content(n):
return [
html.Div("A", id="a"),
html.Div("B", id="b")
] if n else "No content yet"
@app.callback(
Output("output1", "children"),
[Input("a", "children"), Input("b", "children")],
[State("title", "children")]
)
def out1(a, b, title):
return str(a) + str(b) + str(title)
@app.callback(
Output("output2", "children"),
[Input("output1", "children")]
)
def out2(out1):
return out1 + " - final"
if __name__ == "__main__":
app.run_server(debug=True) Like that, the @app.callback(
Output("output2", "children"),
[Input("output1", "children"), Input("title", "children")]
)
def out2(out1, title):
return out1 + " - final: " + title Then it will fire on load. My first thought was that this didn't make a whole lot of sense - if we're treating this situation like "its inputs don't exist, therefore However, you might also think of it like "its inputs don't exist, therefore Unless anyone wants to argue that this is a bug and we should really fire |
Can you refresh my memory as to the behavior for callbacks with some What would be the behavior for a multi-output callback on output1 and output2? |
Looks like we would potentially want to test/lock behavior for the following scenarios:
Other modifiers:
|
Thanks, that's a really useful collection of test cases! If all the inputs have Multi-output callbacks: if none of the inputs are present, it would be OK to have only some of the outputs present, this would not be an error. This could happen for example if one of the outputs was inside the |
👍 |
except when all inputs have multivalued wildcards and all outputs exist
except when all inputs have multivalued wildcards and all outputs exist
except when all inputs have multivalued wildcards and all outputs exist
Describe your context
Describe the bug
When components are added to the layout of an app in dash 1.11 (e.g in a multipage app), all the callbacks associated with those new components are triggered in python but they won't update the app on the front end if a ReferenceError was detected (i.e if an output to a callback was added without the corresponding inputs).
Expected behavior
In previous versions of dash, all the well defined callbacks associated with the components added to the dash layout would still update the app
The text was updated successfully, but these errors were encountered: