This commit is contained in:
benedikt-bartscher 2025-02-22 16:36:58 +00:00 committed by GitHub
commit a011856e65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -857,6 +857,9 @@ class Config(Base):
# Path to file containing key-values pairs to override in the environment; Dotenv format.
env_file: Optional[str] = None
# Whether to automatically create setters for state base vars
state_auto_setters: bool = True
# Whether to display the sticky "Built with Reflex" badge on all pages.
show_built_with_reflex: Optional[bool] = None

View File

@ -1018,7 +1018,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
f'Found var "{prop._js_expr}" with type {prop._var_type}.'
)
cls._set_var(prop)
cls._create_setter(prop)
if get_config().state_auto_setters:
cls._create_setter(prop)
cls._set_default_value(prop)
@classmethod