From 9e963338efc7b737134735db8a85d9a3e7ad174b Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Tue, 17 Dec 2024 19:26:58 +0300 Subject: [PATCH] add check for default value being null --- reflex/utils/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reflex/utils/types.py b/reflex/utils/types.py index 4e54aa70f..d39f1b483 100644 --- a/reflex/utils/types.py +++ b/reflex/utils/types.py @@ -285,7 +285,8 @@ def true_type_for_pydantic_field(f: ModelField): type_ = f.outer_type_ if ( - (isinstance(f.annotation, str) and f.annotation.startswith("Optional")) + f.field_info.default is None + or (isinstance(f.annotation, str) and f.annotation.startswith("Optional")) or ( isinstance(f.annotation, ForwardRef) and f.annotation.__forward_arg__.startswith("Optional")