Skip to content

Commit 0bc0d32

Browse files
authored
Merge pull request plotly#2105 from pikhovkin/pikhovkin-patch-1
Fix dependencies between Dash components
2 parents 6b8228a + 0b711e7 commit 0bc0d32

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2828
- [#2257](https://github.com/plotly/dash/pull/2257) Fix tuple types in the TypeScript component generator.
2929
- [#2293](https://github.com/plotly/dash/pull/2293) Fix Dropdown useMemo not detecting equal objects
3030
- [#2277](https://github.com/plotly/dash/pull/2277) Use dropdown styles from node_modules, instead of from stored css file
31+
- [#2105](https://github.com/plotly/dash/pull/2105) Fix order of dash component libraries imports.
3132

3233
### Changed
3334

dash/_utils.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,30 @@ def gen_salt(chars):
219219
)
220220

221221

222+
class OrderedSet(collections.abc.MutableSet):
223+
def __init__(self, *args):
224+
self._data = []
225+
for i in args:
226+
self.add(i)
227+
228+
def add(self, value):
229+
if value not in self._data:
230+
self._data.append(value)
231+
232+
def discard(self, value):
233+
self._data.remove(value)
234+
235+
def __contains__(self, x):
236+
return x in self._data
237+
238+
def __len__(self):
239+
return len(self._data)
240+
241+
def __iter__(self):
242+
for i in self._data:
243+
yield i
244+
245+
222246
def coerce_to_list(obj):
223247
if not isinstance(obj, (list, tuple)):
224248
return [obj]

dash/development/base_component.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import uuid
66
import random
77

8-
from .._utils import patch_collections_abc, stringify_id
8+
from .._utils import patch_collections_abc, stringify_id, OrderedSet
99

1010
MutableSequence = patch_collections_abc("MutableSequence")
1111

@@ -16,7 +16,7 @@
1616
class ComponentRegistry:
1717
"""Holds a registry of the namespaces used by components."""
1818

19-
registry = set()
19+
registry = OrderedSet()
2020
children_props = collections.defaultdict(dict)
2121

2222
@classmethod

0 commit comments

Comments
 (0)