Skip to content

Commit

Permalink
get it right pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Jan 7, 2025
1 parent 37bb97b commit b512903
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions reflex/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,9 @@ def _get_vars(
Each var referenced by the component (props, styles, event handlers).
"""
ignore_ids = ignore_ids or set()
vars = getattr(self, "__vars", None)
vars: List[Var] | None = getattr(self, "__vars", None)
if vars is not None:
return vars
yield from vars
vars = self.__vars = []
# Get Vars associated with event trigger arguments.
for _, event_vars in self._get_vars_from_event_triggers(self.event_triggers):
Expand Down Expand Up @@ -1087,7 +1087,7 @@ def _get_vars(
)
vars.extend(child_vars)

return vars
yield from vars

def _event_trigger_values_use_state(self) -> bool:
"""Check if the values of a component's event trigger use state.
Expand Down Expand Up @@ -1831,12 +1831,12 @@ def _get_vars(
Each var referenced by the component (props, styles, event handlers).
"""
ignore_ids = ignore_ids or set()
return (
super()._get_vars(include_children=include_children, ignore_ids=ignore_ids)
+ [prop for prop in self.props.values() if isinstance(prop, Var)]
+ self.get_component(self)._get_vars(
include_children=include_children, ignore_ids=ignore_ids
)
yield from super()._get_vars(
include_children=include_children, ignore_ids=ignore_ids
)
yield from filter(lambda prop: isinstance(prop, Var), self.props.values())
yield from self.get_component(self)._get_vars(
include_children=include_children, ignore_ids=ignore_ids
)

@lru_cache(maxsize=None) # noqa
Expand Down

0 comments on commit b512903

Please sign in to comment.