Skip to content

Commit 9164e36

Browse files
authored
Merge branch 'dev' into update-clipboard
2 parents b4b8619 + 22e0b3b commit 9164e36

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
88
- [#3568]((https://github.com/plotly/dash/pull/3568) Added `children` and `copied_children` props to `dcc.Clipboard` to customize the button contents before and after copying.
99
- [#3534]((https://github.com/plotly/dash/pull/3534) Adds `playsInline` prop to `html.Video`. Based on [#2338]((https://github.com/plotly/dash/pull/2338)
1010
- [#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)
11+
- [#3564](https://github.com/plotly/dash/pull/3564) Add new parameter `hide_all_callbacks` to `run()`. Closes [#3493](https://github.com/plotly/dash/issues/3493)
1112

1213
## Fixed
1314
- [#3541](https://github.com/plotly/dash/pull/3541) Remove last reference of deprecated `pkg_resources`.

dash/_callback.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def callback(
7979
on_error: Optional[Callable[[Exception], Any]] = None,
8080
api_endpoint: Optional[str] = None,
8181
optional: Optional[bool] = False,
82-
hidden: Optional[bool] = False,
82+
hidden: Optional[bool] = None,
8383
**_kwargs,
8484
) -> Callable[..., Any]:
8585
"""
@@ -277,7 +277,7 @@ def insert_callback(
277277
dynamic_creator: Optional[bool] = False,
278278
no_output=False,
279279
optional=False,
280-
hidden=False,
280+
hidden=None,
281281
):
282282
if prevent_initial_call is None:
283283
prevent_initial_call = config_prevent_initial_callbacks
@@ -651,7 +651,7 @@ def register_callback(
651651
running=running,
652652
no_output=not has_output,
653653
optional=_kwargs.get("optional", False),
654-
hidden=_kwargs.get("hidden", False),
654+
hidden=_kwargs.get("hidden", None),
655655
)
656656

657657
# pylint: disable=too-many-locals
@@ -854,6 +854,7 @@ def register_clientside_callback(
854854
None,
855855
prevent_initial_call,
856856
no_output=no_output,
857+
hidden=kwargs.get("hidden", False),
857858
)
858859

859860
# If JS source is explicitly given, create a namespace and function

dash/dash-renderer/src/wrapper/DashContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type LoadingOptions = {
1818
* Useful if you want the loading of a child component
1919
* as the path is available in `child.props.componentPath`.
2020
*/
21-
rawPath?: boolean;
21+
rawPath?: (string | number)[];
2222
/**
2323
* Function used to filter the properties of the loading component.
2424
* Filter argument is an Entry of `{path, property, id}`.

dash/dash.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ def __init__( # pylint: disable=too-many-statements
544544
include_pages_meta=include_pages_meta,
545545
description=description,
546546
health_endpoint=health_endpoint,
547+
hide_all_callbacks=False,
547548
)
548549
self.config.set_read_only(
549550
[
@@ -1646,6 +1647,16 @@ def _setup_server(self):
16461647
self.callback_map[k] = _callback.GLOBAL_CALLBACK_MAP.pop(k)
16471648

16481649
self._callback_list.extend(_callback.GLOBAL_CALLBACK_LIST)
1650+
1651+
# For each callback function, if the hidden parameter uses the default value None,
1652+
# replace it with the actual value of the self.config.hide_all_callbacks.
1653+
self._callback_list = [
1654+
{**_callback, "hidden": self.config.get("hide_all_callbacks", False)}
1655+
if _callback.get("hidden") is None
1656+
else _callback
1657+
for _callback in self._callback_list
1658+
]
1659+
16491660
_callback.GLOBAL_CALLBACK_LIST.clear()
16501661

16511662
_validate.validate_background_callbacks(self.callback_map)
@@ -2293,6 +2304,7 @@ def run(
22932304
port: Optional[Union[str, int]] = None,
22942305
proxy: Optional[str] = None,
22952306
debug: Optional[bool] = None,
2307+
hide_all_callbacks: bool = False,
22962308
jupyter_mode: Optional[JupyterDisplayMode] = None,
22972309
jupyter_width: str = "100%",
22982310
jupyter_height: int = 650,
@@ -2341,6 +2353,14 @@ def run(
23412353
via ``run``. env: ``DASH_DEBUG``
23422354
:type debug: bool
23432355
2356+
:param hide_all_callbacks: Default ``False``: Sets the default value of
2357+
``hidden`` for all callbacks added to the app. Normally all callbacks
2358+
are visible in the devtools callbacks tab. You can set this for
2359+
individual callbacks by setting ``hidden`` in their definitions, or set
2360+
it ``True`` here in which case you must explicitly set it ``False`` for
2361+
those callbacks you wish to remain visible in the devtools callbacks tab.
2362+
:type hide_all_callbacks: bool
2363+
23442364
:param dev_tools_ui: Show the dev tools UI. env: ``DASH_UI``
23452365
:type dev_tools_ui: bool
23462366
@@ -2407,6 +2427,10 @@ def run(
24072427
24082428
:return:
24092429
"""
2430+
2431+
# Update self.config.hide_all_callbacks
2432+
self.config.update({"hide_all_callbacks": hide_all_callbacks})
2433+
24102434
if debug is None:
24112435
debug = get_combined_config("debug", None, False)
24122436

0 commit comments

Comments
 (0)