smarter yield

This commit is contained in:
Khaleel Al-Adhami 2025-02-14 15:11:09 -08:00
parent af4ce357aa
commit d399748cc3

View File

@ -690,9 +690,13 @@ class Component(BaseComponent, ABC):
Yields: Yields:
The components in the props. The components in the props.
""" """
for prop in self.get_props(): yield from (
value = getattr(self, prop) component
yield from _components_from(value) for prop in self.get_props()
if (value := getattr(self, prop)) is not None
and isinstance(value, (BaseComponent, Var))
for component in _components_from(value)
)
@classmethod @classmethod
def create(cls, *children, **props) -> Self: def create(cls, *children, **props) -> Self: