Hi all,
I’m running into an issue where setting suppress_callback_exceptions
works for ignoring callbacks with missing Input
s, but not for callbacks with missing State
s (I.e. you have a callback with all the Input
s defined and rendered in the app layout, but one or more State
s isn’t rendered yet).
I have a small example of this here:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
# Configure app
app = dash.Dash(
__name__,
meta_tags=[{'name': 'viewport', 'content': 'width=device_width'}]
)
app.config.suppress_callback_exceptions = True
# Layout
app.layout = html.Div(
[
# Comment this out to cause an "Error loading dependencies" error
dcc.Store(id='some-store'),
# Comment this whole button out along with the Store to fix
# the dependencies error
html.Button(
"Do something",
id='do-something'
),
html.Div(
html.H1("Did something!"),
id='did-something-container',
hidden=True
)
]
)
# Callbacks
@app.callback(
Output('did-something-container', 'hidden'),
[Input('do-something', 'n_clicks')],
[State('some-store', 'data')]
)
def update_header(clicks, data):
if not clicks:
return True
else:
return False
if __name__ == "__main__":
app.run_server(debug=True, dev_tools_silence_routes_logging=True)
If you comment out the dcc.Store
, you get an Error loading dependencies
message when you load the page. However, if you comment out both the dcc.Store
and the html.Button
, everything loads just fine.
Is this the expected behavior of suppress_callback_exceptions
? If so, is there any workaround for the situation I’m encountering?