From fbde2b27fe562ada1c2e0ad3c4610cc2b350fda3 Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 6 May 2025 09:49:27 -0400 Subject: [PATCH 1/2] Fix dev only resource filtering --- dash/resources.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dash/resources.py b/dash/resources.py index 9013f51fd4..8aad614e6d 100644 --- a/dash/resources.py +++ b/dash/resources.py @@ -24,6 +24,7 @@ "asset_path": str, "external_only": bool, "filepath": str, + "dev_only": bool, }, total=False, ) @@ -52,6 +53,7 @@ def _filter_resources( filtered_resources = [] for s in all_resources: filtered_resource = {} + valid_resource = True if "dynamic" in s: filtered_resource["dynamic"] = s["dynamic"] if "async" in s: @@ -78,12 +80,16 @@ def _filter_resources( ) if "namespace" in s: filtered_resource["namespace"] = s["namespace"] + if "external_url" in s and ( s.get("external_only") or not self.config.serve_locally ): filtered_resource["external_url"] = s["external_url"] elif "dev_package_path" in s and (dev_bundles or s.get("dev_only")): - filtered_resource["relative_package_path"] = s["dev_package_path"] + if dev_bundles: + filtered_resource["relative_package_path"] = s["dev_package_path"] + else: + valid_resource = False elif "relative_package_path" in s: filtered_resource["relative_package_path"] = s["relative_package_path"] elif "absolute_path" in s: @@ -113,7 +119,8 @@ def _filter_resources( """ ) - filtered_resources.append(filtered_resource) + if valid_resource: + filtered_resources.append(filtered_resource) return filtered_resources From 4269647fff1eb37841d2e2b8403a5d0c6a9300b7 Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 6 May 2025 11:10:13 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6dba82d31..866d301f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## Fixed - [#3279](https://github.com/plotly/dash/pull/3279) Fix an issue where persisted values were incorrectly pruned when updated via callback. Now, callback returned values are correctly stored in the persistence storage. Fix [#2678](https://github.com/plotly/dash/issues/2678) +- [#3298](https://github.com/plotly/dash/pull/3298) Fix dev_only resources filtering. ## Added - [#3294](https://github.com/plotly/dash/pull/3294) Added the ability to pass `allow_optional` to Input and State to allow callbacks to work even if these components are not in the dash layout.