diff --git a/reflex/utils/types.py b/reflex/utils/types.py index 258a6797b0b..d9b79b17ac8 100644 --- a/reflex/utils/types.py +++ b/reflex/utils/types.py @@ -263,8 +263,12 @@ def is_classvar(a_type: Any) -> bool: Returns: Whether the type is a ClassVar. """ - return a_type is ClassVar or ( - type(a_type) is _GenericAlias and a_type.__origin__ is ClassVar + return ( + a_type is ClassVar + or (type(a_type) is _GenericAlias and a_type.__origin__ is ClassVar) + or ( + type(a_type) is ForwardRef and a_type.__forward_arg__.startswith("ClassVar") + ) )