Quellcode durchsuchen

fix initial state without cv fallback (#3670)

benedikt-bartscher vor 8 Monaten
Ursprung
Commit
b7c7197f1d
2 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 3 1
      reflex/compiler/utils.py
  2. 1 1
      reflex/state.py

+ 3 - 1
reflex/compiler/utils.py

@@ -152,7 +152,9 @@ def compile_state(state: Type[BaseState]) -> dict:
         console.warn(
             f"Failed to compile initial state with computed vars, excluding them: {e}"
         )
-        initial_state = state(_reflex_internal_init=True).dict(include_computed=False)
+        initial_state = state(_reflex_internal_init=True).dict(
+            initial=True, include_computed=False
+        )
     return format.format_state(initial_state)
 
 

+ 1 - 1
reflex/state.py

@@ -1784,7 +1784,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
             prop_name: self.get_value(getattr(self, prop_name))
             for prop_name in self.base_vars
         }
-        if initial:
+        if initial and include_computed:
             computed_vars = {
                 # Include initial computed vars.
                 prop_name: (