diff --git a/reflex/compiler/utils.py b/reflex/compiler/utils.py index 630eb9680..dc7c384a4 100644 --- a/reflex/compiler/utils.py +++ b/reflex/compiler/utils.py @@ -23,7 +23,7 @@ from reflex.components.base import ( from reflex.components.component import Component, ComponentStyle, CustomComponent from reflex.state import Cookie, LocalStorage, State from reflex.style import Style -from reflex.utils import format, imports, path_ops +from reflex.utils import console, format, imports, path_ops from reflex.vars import ImportVar # To re-export this function. @@ -138,7 +138,10 @@ def compile_state(state: Type[State]) -> dict: """ try: initial_state = state().dict() - except Exception: + except Exception as e: + console.warn( + f"Failed to compile initial state with computed vars, excluding them: {e}" + ) initial_state = state().dict(include_computed=False) return format.format_state(initial_state)