Yield ``(prop_name, child_component)`` for all component-valued props. Walks ``children`` plus any props declared in the component's ``_children_props`` list. Supports nested path expressions like ``control_groups[].children`` and ``insights.title``.
(
component: Component,
)
| 49 | |
| 50 | |
| 51 | def iter_children( |
| 52 | component: Component, |
| 53 | ) -> Generator[tuple[str, Component], None, None]: |
| 54 | """Yield ``(prop_name, child_component)`` for all component-valued props. |
| 55 | |
| 56 | Walks ``children`` plus any props declared in the component's |
| 57 | ``_children_props`` list. Supports nested path expressions like |
| 58 | ``control_groups[].children`` and ``insights.title``. |
| 59 | """ |
| 60 | props_to_walk = ["children"] + getattr(component, "_children_props", []) |
| 61 | for prop_path in props_to_walk: |
| 62 | for child in get_children(component, prop_path): |
| 63 | yield prop_path, child |
| 64 | |
| 65 | |
| 66 | def get_children(component: Any, prop_path: str) -> list[Component]: |
no test coverage detected
searching dependent graphs…