diff --git a/reflex/state.py b/reflex/state.py index b2850de556..d080e57c90 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -587,7 +587,7 @@ def add_var(cls, name: str, type_: Any, default_value: Any = None): for substate_class in cls.__subclasses__(): substate_class.vars.setdefault(name, var) - # Reinitialize dependency tracking dicts + # Reinitialize dependency tracking dicts. cls._init_var_dependency_dicts() @classmethod @@ -799,6 +799,9 @@ def inner_func(self) -> List: cls.vars[param] = cls.computed_vars[param] = func._var_set_state(cls) # type: ignore setattr(cls, param, func) + # Reinitialize dependency tracking dicts. + cls._init_var_dependency_dicts() + def __getattribute__(self, name: str) -> Any: """Get the state var.