how much does caching help?
This commit is contained in:
parent
d399748cc3
commit
800b2df2c6
@ -684,19 +684,20 @@ class Component(BaseComponent, ABC):
|
|||||||
"""
|
"""
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
def _get_components_in_props(self) -> Iterator[BaseComponent]:
|
@lru_cache(maxsize=None) # noqa: B019
|
||||||
|
def _get_components_in_props(self) -> Sequence[BaseComponent]:
|
||||||
"""Get the components in the props.
|
"""Get the components in the props.
|
||||||
|
|
||||||
Yields:
|
Yields:
|
||||||
The components in the props.
|
The components in the props.
|
||||||
"""
|
"""
|
||||||
yield from (
|
return [
|
||||||
component
|
component
|
||||||
for prop in self.get_props()
|
for prop in self.get_props()
|
||||||
if (value := getattr(self, prop)) is not None
|
if (value := getattr(self, prop)) is not None
|
||||||
and isinstance(value, (BaseComponent, Var))
|
and isinstance(value, (BaseComponent, Var))
|
||||||
for component in _components_from(value)
|
for component in _components_from(value)
|
||||||
)
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, *children, **props) -> Self:
|
def create(cls, *children, **props) -> Self:
|
||||||
|
Loading…
Reference in New Issue
Block a user