diff --git a/reflex/components/component.py b/reflex/components/component.py index cf6f67c82..b12ff43ee 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -286,7 +286,7 @@ class Component(BaseComponent, ABC): if kwargs[key] is None: raise TypeError - expected_type = fields[key].outer_type_.__args__[0] + expected_type = fields[key].annotation.__args__[0] # validate literal fields. types.validate_literal( key, value, expected_type, type(self).__name__ @@ -301,7 +301,7 @@ class Component(BaseComponent, ABC): except TypeError: # If it is not a valid var, check the base types. passed_type = type(value) - expected_type = fields[key].outer_type_ + expected_type = fields[key].annotation if not types._issubclass(passed_type, expected_type): value_name = value._var_name if isinstance(value, Var) else value raise TypeError( @@ -581,7 +581,7 @@ class Component(BaseComponent, ABC): name for name, field in cls.get_fields().items() if name in cls.get_props() - and types._issubclass(field.outer_type_, Component) + and types._issubclass(field.annotation, Component) } @classmethod diff --git a/reflex/state.py b/reflex/state.py index e055d77fe..9f6daf96e 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -432,7 +432,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): # Set the base and computed vars. cls.base_vars = { - f.name: BaseVar(_var_name=f.name, _var_type=f.outer_type_)._var_set_state( + f.name: BaseVar(_var_name=f.name, _var_type=f.annotation)._var_set_state( cls ) for f in cls.get_fields().values()