Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## Added
- [#3534]((https://github.com/plotly/dash/pull/3534) Adds `playsInline` prop to `html.Video`. Based on [#2338]((https://github.com/plotly/dash/pull/2338)
- [#3541](https://github.com/plotly/dash/pull/3541) Add `attributes` dictionary to be be formatted on script/link (_js_dist/_css_dist) tags of the index, allows for `type="module"` or `type="importmap"`. [#3538](https://github.com/plotly/dash/issues/3538)
- [#3564](https://github.com/plotly/dash/pull/3564) Add new parameter `hide_all_callbacks` to `dash.Dash()`. Closes [#3493](https://github.com/plotly/dash/issues/3493)

## Fixed
- [#3541](https://github.com/plotly/dash/pull/3541) Remove last reference of deprecated `pkg_resources`.
Expand Down
6 changes: 3 additions & 3 deletions dash/_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def callback(
on_error: Optional[Callable[[Exception], Any]] = None,
api_endpoint: Optional[str] = None,
optional: Optional[bool] = False,
hidden: Optional[bool] = False,
hidden: Optional[bool] = None,
**_kwargs,
) -> Callable[..., Any]:
"""
Expand Down Expand Up @@ -277,7 +277,7 @@ def insert_callback(
dynamic_creator: Optional[bool] = False,
no_output=False,
optional=False,
hidden=False,
hidden=None,
):
if prevent_initial_call is None:
prevent_initial_call = config_prevent_initial_callbacks
Expand Down Expand Up @@ -651,7 +651,7 @@ def register_callback(
running=running,
no_output=not has_output,
optional=_kwargs.get("optional", False),
hidden=_kwargs.get("hidden", False),
hidden=_kwargs.get("hidden", None),
)

# pylint: disable=too-many-locals
Expand Down
17 changes: 17 additions & 0 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ class Dash(ObsoleteChecker):
those callbacks you wish to have an initial call. This setting has no
effect on triggering callbacks when their inputs change later on.

:param hide_all_callbacks: Default ``False``: Sets the default value of
``hidden`` for all callbacks added to the app. Normally all callbacks
are visible in the devtools callbacks tab. You can set this for
individual callbacks by setting ``hidden`` in their definitions, or set
it ``True`` here in which case you must explicitly set it ``False`` for
those callbacks you wish to remain visible in the devtools callbacks tab.

:param show_undo_redo: Default ``False``, set to ``True`` to enable undo
and redo buttons for stepping through the history of the app state.
:type show_undo_redo: boolean
Expand Down Expand Up @@ -457,6 +464,7 @@ def __init__( # pylint: disable=too-many-statements
external_stylesheets: Optional[Sequence[Union[str, Dict[str, Any]]]] = None,
suppress_callback_exceptions: Optional[bool] = None,
prevent_initial_callbacks: bool = False,
hide_all_callbacks: bool = False,
show_undo_redo: bool = False,
extra_hot_reload_paths: Optional[Sequence[str]] = None,
plugins: Optional[list] = None,
Expand Down Expand Up @@ -537,6 +545,7 @@ def __init__( # pylint: disable=too-many-statements
"suppress_callback_exceptions", suppress_callback_exceptions, False
),
prevent_initial_callbacks=prevent_initial_callbacks,
hide_all_callbacks=hide_all_callbacks,
show_undo_redo=show_undo_redo,
extra_hot_reload_paths=extra_hot_reload_paths or [],
title=title,
Expand Down Expand Up @@ -1646,6 +1655,14 @@ def _setup_server(self):
self.callback_map[k] = _callback.GLOBAL_CALLBACK_MAP.pop(k)

self._callback_list.extend(_callback.GLOBAL_CALLBACK_LIST)
# For each callback function, if the hidden parameter uses the default value None,
# replace it with the actual value of the hide_all_callbacks property of the current application instance.
self._callback_list = [
{**_callback, "hidden": self.config.get("hide_all_callbacks", False)}
if _callback.get("hidden") is None
else _callback
for _callback in self._callback_list
]
_callback.GLOBAL_CALLBACK_LIST.clear()

_validate.validate_background_callbacks(self.callback_map)
Expand Down
Loading