Description:
The current implementation of the hierarchical data proxy only creates reactive core.Config atoms for the leaf nodes of the state tree. While this approach is highly performant and granular, it has two significant limitations:
- Inability to Observe Sub-Trees: It is not possible to create an effect that reacts to any arbitrary change within a nested object (e.g., an effect on
data.user does not re-run when data.user.name changes).
- Problematic Atomic Replacements: Atomically replacing an entire branch of the state (e.g.,
data.user = { ... }) does not work as expected, as it orphans the old Config atoms instead of triggering updates.
This feature request proposes enhancing the system to support "Full-Tree Reactivity," where every node in the state tree (both branches and leaves) is a reactive atom.
Benefits:
- Intuitive Reactivity: Developers could subscribe to any part of the state tree, and changes would propagate as expected.
- Powerful State Patterns: Would enable atomic sub-tree replacements and simplify state management logic.
- Improved Developer Experience: Aligns the state manager with modern reactive principles, making it more powerful and easier to use.
Considerations:
- This is a complex enhancement that will require careful implementation to manage performance.
- A "notification bubbling" system will be needed to ensure changes in leaf nodes correctly trigger effects subscribed to parent nodes.
Implementing this feature would be a major step forward for the Neo.mjs state management system, providing a more robust and developer-friendly experience.
Description:
The current implementation of the hierarchical data proxy only creates reactive
core.Configatoms for the leaf nodes of the state tree. While this approach is highly performant and granular, it has two significant limitations:data.userdoes not re-run whendata.user.namechanges).data.user = { ... }) does not work as expected, as it orphans the oldConfigatoms instead of triggering updates.This feature request proposes enhancing the system to support "Full-Tree Reactivity," where every node in the state tree (both branches and leaves) is a reactive atom.
Benefits:
Considerations:
Implementing this feature would be a major step forward for the Neo.mjs state management system, providing a more robust and developer-friendly experience.