Move the core state machinery into reflex_base.state
Ā
MA
12d ago+2296+2296+0123456789012345678901234567890123456789-2113-2113-0123456789012345678901234567890123456789
All Submissions:
- Have you followed the guidelines stated in CONTRIBUTING.md file?
- Have you checked to ensure there aren't any other open Pull Requests for the desired changed?
Type of change
- New feature (non-breaking change which adds functionality)
Part 3 of 4 of #7302. Stack: 1 field descriptors (#7312) ā 2 state locks (#7313) ā 3 core state in reflex-base ā 4 dispatch_value. Based on #7313.
Description
Moves the core state machinery into a new reflex_base.state package:
node.py:StateNodeis a node of a state tree. It holds the links to its parent and substates, dirty tracking, computed var invalidation, deltas,async withlocking, pickling and the dev-mode typo guard.rx.BaseStatenow extends it with routing, state loading and the event handler machinery. A plainEvenMoreBasicBaseStateclass still holds fields with no tree around it.delta.py,proxy.py(MutableProxy) andtoken.pymove here fromreflex.istate. Their old import paths (reflex.istate.proxy,reflex.istate.delta,reflex.istate.manager.token) still work through module aliases.Fieldnow wraps mutable values inMutableProxydirectly, instead of through a hook thatreflexinstalled.wraptmoves fromreflex's dependencies toreflex-base's.
This is mostly a move: reflex/state.py shrinks by about 720 lines. StateNode is typed against reflex.state.BaseState under TYPE_CHECKING, like the rest of reflex-base, so a few pyright: ignore comments cover the places where it returns itself or its class.
Changes To Core Features:
- Have you added an explanation of what your changes do and why you'd like us to include them?
- Have you written new tests for your core changes, as applicable?
- Have you successfully ran tests with your changes locally?
š¤ Generated with Claude Code