Skip to content

Commit e6e15cf

Browse files
authored
Merge pull request #749 from superannotateai/get_component_config_v2
Get component config v2
2 parents 5e286f1 + c7faf6e commit e6e15cf

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55

6-
__version__ = "4.4.30"
6+
__version__ = "4.4.31dev1"
77

88
os.environ.update({"sa_version": __version__})
99
sys.path.append(os.path.split(os.path.realpath(__file__))[0])

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -501,24 +501,23 @@ def get_component_config(self, project: Union[NotEmptyStr, int], component_id: s
501501
"""
502502

503503
def retrieve_context(
504-
component_data: List[dict], component_pk: str
504+
component_data: List[dict], component_pk: str
505505
) -> Tuple[bool, typing.Any]:
506506
try:
507507
for component in component_data:
508-
if (
509-
component["type"] == "webComponent"
510-
and component["id"] == component_pk
511-
):
512-
return True, component.get("context")
513-
if (
514-
component["type"] in ("group", "grid")
515-
and "children" in component
516-
):
508+
if "children" in component:
517509
found, val = retrieve_context(
518510
component["children"], component_pk
519511
)
520512
if found:
521513
return found, val
514+
if (
515+
"id" in component and
516+
component["id"] == component_pk
517+
and component["type"] == "webComponent"
518+
):
519+
return True, json.loads(component.get("context"))
520+
522521
except KeyError as e:
523522
logger.debug("Got key error:", component_data)
524523
raise e

0 commit comments

Comments
 (0)