Skip to content

Commit 3c8da1b

Browse files
committed
Remove reflex.state import from reflex_base package
Instead, the pyi_generator just pops out the `State` attribute from `__annotations__` because it was in EXCLUDED_PROPS anyway.
1 parent 1cc2431 commit 3c8da1b

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

packages/reflex-base/src/reflex_base/components/component.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,7 +3019,3 @@ def create(
30193019
),
30203020
_var_value=value,
30213021
)
3022-
3023-
3024-
# Late import of reflex.state to resolve ForwardRef type hints without circular import.
3025-
import reflex.state # noqa: E402

packages/reflex-base/src/reflex_base/utils/pyi_generator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ def _extract_class_props_as_ast_nodes(
572572
**type_hint_globals,
573573
**_get_class_annotation_globals(target_class),
574574
}
575+
# State attr isn't really a prop and cannot be resolved, so pop it off.
576+
target_class.__annotations__.pop("State", None)
575577
type_hints = typing.get_type_hints(target_class, globalns=annotation_globals)
576578
for name, value in reversed(type_hints.items()):
577579
if (

0 commit comments

Comments
 (0)