Skip to content

Commit e57d9e2

Browse files
committed
Update get_component_config, add support for grid, tabs
1 parent e7319ea commit e57d9e2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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)