Skip to content

Commit bb13521

Browse files
authored
Merge pull request #3298 from plotly/fix/dev_only_resource
Fix dev only resource filtering
2 parents 692298e + 4269647 commit bb13521

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77

88
## Fixed
99
- [#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)
10+
- [#3298](https://github.com/plotly/dash/pull/3298) Fix dev_only resources filtering.
1011

1112
## Added
1213
- [#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.

dash/resources.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"asset_path": str,
2525
"external_only": bool,
2626
"filepath": str,
27+
"dev_only": bool,
2728
},
2829
total=False,
2930
)
@@ -52,6 +53,7 @@ def _filter_resources(
5253
filtered_resources = []
5354
for s in all_resources:
5455
filtered_resource = {}
56+
valid_resource = True
5557
if "dynamic" in s:
5658
filtered_resource["dynamic"] = s["dynamic"]
5759
if "async" in s:
@@ -78,12 +80,16 @@ def _filter_resources(
7880
)
7981
if "namespace" in s:
8082
filtered_resource["namespace"] = s["namespace"]
83+
8184
if "external_url" in s and (
8285
s.get("external_only") or not self.config.serve_locally
8386
):
8487
filtered_resource["external_url"] = s["external_url"]
8588
elif "dev_package_path" in s and (dev_bundles or s.get("dev_only")):
86-
filtered_resource["relative_package_path"] = s["dev_package_path"]
89+
if dev_bundles:
90+
filtered_resource["relative_package_path"] = s["dev_package_path"]
91+
else:
92+
valid_resource = False
8793
elif "relative_package_path" in s:
8894
filtered_resource["relative_package_path"] = s["relative_package_path"]
8995
elif "absolute_path" in s:
@@ -113,7 +119,8 @@ def _filter_resources(
113119
"""
114120
)
115121

116-
filtered_resources.append(filtered_resource)
122+
if valid_resource:
123+
filtered_resources.append(filtered_resource)
117124

118125
return filtered_resources
119126

0 commit comments

Comments
 (0)