Skip to content

Commit 1cb7455

Browse files
committed
Map namespace to package name in case they differ.
1 parent 330a2c4 commit 1cb7455

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

dash/dash.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,10 @@ def serve_reload_hash(self):
806806
)
807807

808808
def serve_dist(self):
809-
libraries = flask.request.get_json()
809+
libraries = [
810+
ComponentRegistry.namespace_to_package.get(lib, lib)
811+
for lib in flask.request.get_json()
812+
]
810813
dists = []
811814
for dist_type in ("_js_dist", "_css_dist"):
812815
resources = ComponentRegistry.get_resources(dist_type, libraries)

dash/development/base_component.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ComponentRegistry:
1818

1919
registry = OrderedSet()
2020
children_props = collections.defaultdict(dict)
21+
namespace_to_package = {}
2122

2223
@classmethod
2324
def get_resources(cls, resource_name, includes=None):
@@ -44,10 +45,12 @@ def __new__(mcs, name, bases, attributes):
4445
# as it doesn't have the namespace.
4546
return component
4647

48+
_namespace = attributes.get("_namespace", module)
49+
ComponentRegistry.namespace_to_package[_namespace] = module
4750
ComponentRegistry.registry.add(module)
48-
ComponentRegistry.children_props[attributes.get("_namespace", module)][
49-
name
50-
] = attributes.get("_children_props")
51+
ComponentRegistry.children_props[_namespace][name] = attributes.get(
52+
"_children_props"
53+
)
5154

5255
return component
5356

0 commit comments

Comments
 (0)