Is your feature request related to a problem? Please describe.
The current reactive system in Neo.mjs, while powerful, can sometimes lead to unintended dependencies. Specifically, when code within an Effect's execution path (e.g., within createVdom or a hook like useConfig) needs to access a reactive property (like ComponentManager.registry via Neo.getComponent()) without making that property a dependency of the Effect, it can lead to unnecessary re-runs or infinite loops.
Describe the solution you'd like
Implement a mechanism within EffectManager to temporarily pause dependency tracking. This involves:
- Modifying
Neo.core.Config.get() to delegate dependency registration to EffectManager.addDependency().
- Adding
isPaused flag, addDependency(config), pause(), and resume() methods to Neo.core.EffectManager.
- Using
EffectManager.pause() and EffectManager.resume() around specific code blocks (e.g., Neo.getComponent() in useConfig()) to prevent unintended dependency tracking.
Describe alternatives you've considered
(None considered, as this is a core architectural improvement.)
Additional context
This feature provides fine-grained control over reactivity, preventing unintended dependencies and improving the robustness of functional components and hooks. It ensures that effects only re-run when their truly intended dependencies change.
Affected Files:
src/core/Config.mjs
src/core/EffectManager.mjs
src/functional/useConfig.mjs
Is your feature request related to a problem? Please describe. The current reactive system in Neo.mjs, while powerful, can sometimes lead to unintended dependencies. Specifically, when code within an
Effect's execution path (e.g., withincreateVdomor a hook likeuseConfig) needs to access a reactive property (likeComponentManager.registryviaNeo.getComponent()) without making that property a dependency of theEffect, it can lead to unnecessary re-runs or infinite loops.Describe the solution you'd like Implement a mechanism within
EffectManagerto temporarily pause dependency tracking. This involves:Neo.core.Config.get()to delegate dependency registration toEffectManager.addDependency().isPausedflag,addDependency(config),pause(), andresume()methods toNeo.core.EffectManager.EffectManager.pause()andEffectManager.resume()around specific code blocks (e.g.,Neo.getComponent()inuseConfig()) to prevent unintended dependency tracking.Describe alternatives you've considered (None considered, as this is a core architectural improvement.)
Additional context This feature provides fine-grained control over reactivity, preventing unintended dependencies and improving the robustness of functional components and hooks. It ensures that effects only re-run when their truly intended dependencies change.
Affected Files:
src/core/Config.mjssrc/core/EffectManager.mjssrc/functional/useConfig.mjs