Skip to content

Fix dependencies between Dash components #2105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- [#2257](https://github.com/plotly/dash/pull/2257) Fix tuple types in the TypeScript component generator.
- [#2293](https://github.com/plotly/dash/pull/2293) Fix Dropdown useMemo not detecting equal objects
- [#2277](https://github.com/plotly/dash/pull/2277) Use dropdown styles from node_modules, instead of from stored css file
- [#2105](https://github.com/plotly/dash/pull/2105) Fix order of dash component libraries imports.

### Changed

Expand Down
24 changes: 24 additions & 0 deletions dash/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,30 @@ def gen_salt(chars):
)


class OrderedSet(collections.abc.MutableSet):
def __init__(self, *args):
self._data = []
for i in args:
self.add(i)

def add(self, value):
if value not in self._data:
self._data.append(value)

def discard(self, value):
self._data.remove(value)

def __contains__(self, x):
return x in self._data

def __len__(self):
return len(self._data)

def __iter__(self):
for i in self._data:
yield i


def coerce_to_list(obj):
if not isinstance(obj, (list, tuple)):
return [obj]
Expand Down
4 changes: 2 additions & 2 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import uuid
import random

from .._utils import patch_collections_abc, stringify_id
from .._utils import patch_collections_abc, stringify_id, OrderedSet

MutableSequence = patch_collections_abc("MutableSequence")

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

registry = set()
registry = OrderedSet()
children_props = collections.defaultdict(dict)

@classmethod
Expand Down