From 66f1e215766385351711ee26fb52c33f711e77de Mon Sep 17 00:00:00 2001 From: Benedikt Bartscher Date: Thu, 29 Feb 2024 00:01:15 +0100 Subject: [PATCH] fix backend vars --- reflex/state.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reflex/state.py b/reflex/state.py index d15d1f1a9..84adbd0fc 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -155,6 +155,9 @@ RESERVED_BACKEND_VAR_NAMES = { "_was_touched", } +SPECIAL_METHODS = { + "model_post_init", # never treat this as an event handler +} def _substate_key( token: str, @@ -517,6 +520,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): """ return ( not name.startswith("_") + and name not in SPECIAL_METHODS and isinstance(value, Callable) and not isinstance(value, EventHandler) and hasattr(value, "__code__")