-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Dash() add new parameter hide_all_callbacks #3564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
dash/_callback.py
Outdated
| config_prevent_initial_callbacks = _kwargs.pop( | ||
| "config_prevent_initial_callbacks", False | ||
| ) | ||
| config_hide_all_callbacks = _kwargs.pop("config_hide_all_callbacks", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are those actually insert when using @callback directly? I think we need a better system for those since we want the same behavior for both @app.callback and @callback.
Think you can refactor these config into a context and use the context instead of passing them around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are those actually insert when using
@callbackdirectly? I think we need a better system for those since we want the same behavior for both@app.callbackand@callback.Think you can refactor these config into a context and use the context instead of passing them around?
Yes, similarly, for prevent_initial_callbacks, the callback functions defined by dash.callback() cannot obtain the setting values from dash.Dash() too.
…config_hide_all_callbacks in _callback.callback()
dash/_callback.py
Outdated
| config_prevent_initial_callbacks = _kwargs.pop( | ||
| "config_prevent_initial_callbacks", False | ||
| # Get prevent_initial_callbacks and hide_all_callbacks from get_app().config | ||
| current_app_config = get_app().config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice usage of get_app, but this will not work if the app hasn't been instanced yet which we can't guarantee with dash.callback.
We can defer it all and map the configs values in the _setup_server after this line:
Line 1648 in a9a173f
| self._callback_list.extend(_callback.GLOBAL_CALLBACK_LIST) |
…ch callback function through the hide_all_callbacks parameter


For the scenario corresponding to #3493, add a new parameter
hide_all_callbackstoDash(), which is used to change the default application value of thehiddenparameter inapp.callback(), improving the convenience of callback debugging for complex applications. Example: