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. 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