Skip to content

Commit

Permalink
state: reinitialize dependency dicts after adding dynamic args
Browse files Browse the repository at this point in the history
  • Loading branch information
masenf committed Nov 22, 2023
1 parent 76a51c1 commit 5d5e712
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion reflex/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5d5e712

Please sign in to comment.