Skip to content

Commit 08885dc

Browse files
committed
cached property question mark
1 parent 66577e6 commit 08885dc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

reflex/components/component.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,8 @@ def get_initial_props(cls) -> set[str]:
10211021
"""
10221022
return set()
10231023

1024-
def _get_components_in_props(self) -> Sequence[BaseComponent]:
1025-
"""Get the components in the props.
1026-
1027-
Returns:
1028-
The components in the props
1029-
"""
1024+
@functools.cached_property
1025+
def _get_component_prop_property(self) -> Sequence[BaseComponent]:
10301026
return [
10311027
component
10321028
for prop in self.get_props()
@@ -1035,6 +1031,14 @@ def _get_components_in_props(self) -> Sequence[BaseComponent]:
10351031
for component in _components_from(value)
10361032
]
10371033

1034+
def _get_components_in_props(self) -> Sequence[BaseComponent]:
1035+
"""Get the components in the props.
1036+
1037+
Returns:
1038+
The components in the props
1039+
"""
1040+
return self._get_component_prop_property
1041+
10381042
@classmethod
10391043
def _validate_children(cls, children: tuple | list):
10401044
from reflex.utils.exceptions import ChildrenTypeError

0 commit comments

Comments
 (0)