From c0364c3e8025e60c1bb50c5075ad11ce97c3e165 Mon Sep 17 00:00:00 2001 From: rmorshea Date: Tue, 22 Nov 2022 16:03:00 -0800 Subject: [PATCH] remove IDOM_FEATURE_INDEX_AS_DEFAULT_KEY opt --- docs/source/about/changelog.rst | 4 +++- src/idom/config.py | 16 ---------------- src/idom/core/layout.py | 19 ++----------------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/docs/source/about/changelog.rst b/docs/source/about/changelog.rst index 415a16699..9af5293b2 100644 --- a/docs/source/about/changelog.rst +++ b/docs/source/about/changelog.rst @@ -23,7 +23,9 @@ more info, see the :ref:`Contributor Guide `. Unreleased ---------- -No changes. +**Removed** + +- :pull:`840` - remove ``IDOM_FEATURE_INDEX_AS_DEFAULT_KEY`` option v0.41.0 diff --git a/src/idom/config.py b/src/idom/config.py index dec2cb958..950b7402c 100644 --- a/src/idom/config.py +++ b/src/idom/config.py @@ -62,22 +62,6 @@ ) """This has been renamed to :data:`IDOM_WEB_MODULES_DIR`""" -IDOM_FEATURE_INDEX_AS_DEFAULT_KEY = _Option( - "IDOM_FEATURE_INDEX_AS_DEFAULT_KEY", - default=True, - mutable=False, - validator=lambda x: bool(int(x)), -) -"""Use the index of elements/components amongst their siblings as the default key. - -The flag's default value is set to true. To return to legacy behavior set -``IDOM_FEATURE_INDEX_AS_DEFAULT_KEY=0``. In a future release, this flag will be removed -entirely and the indices will always be the default key. - -For more information on changes to this feature flag see: -https://github.com/idom-team/idom/issues/351 -""" - IDOM_TESTING_DEFAULT_TIMEOUT = _Option( "IDOM_TESTING_DEFAULT_TIMEOUT", 5.0, diff --git a/src/idom/core/layout.py b/src/idom/core/layout.py index 38bdd6490..4a2561190 100644 --- a/src/idom/core/layout.py +++ b/src/idom/core/layout.py @@ -24,11 +24,7 @@ from uuid import uuid4 from weakref import ref as weakref -from idom.config import ( - IDOM_CHECK_VDOM_SPEC, - IDOM_DEBUG_MODE, - IDOM_FEATURE_INDEX_AS_DEFAULT_KEY, -) +from idom.config import IDOM_CHECK_VDOM_SPEC, IDOM_DEBUG_MODE from idom.utils import Ref from ._event_proxy import _wrap_in_warning_event_proxies @@ -755,7 +751,7 @@ def _process_child_type_and_key( key = None if key is None: - key = _default_key(index) + key = index yield (child, child_type, key) @@ -765,14 +761,3 @@ def _process_child_type_and_key( _DICT_TYPE = _ElementType(1) _COMPONENT_TYPE = _ElementType(2) _STRING_TYPE = _ElementType(3) - - -if IDOM_FEATURE_INDEX_AS_DEFAULT_KEY.current: - - def _default_key(index: int) -> Any: - return index - -else: - - def _default_key(index: int) -> Any: # pragma: no cover - return object()