LearnNewsExamplesServices
Frontmatter
id7026
titleFeature: Fine-grained Reactivity Control with EffectManager.pause()
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 12, 2025, 8:10 PM
updatedAtJul 12, 2025, 8:13 PM
githubUrlhttps://github.com/neomjs/neo/issues/7026
authortobiu
commentsCount0
parentIssue6992
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 12, 2025, 8:13 PM

Feature: Fine-grained Reactivity Control with EffectManager.pause()

Closed v10.0.0-beta.6 enhancement
tobiu
tobiu commented on Jul 12, 2025, 8:10 PM

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:

  1. Modifying Neo.core.Config.get() to delegate dependency registration to EffectManager.addDependency().
  2. Adding isPaused flag, addDependency(config), pause(), and resume() methods to Neo.core.EffectManager.
  3. 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
tobiu assigned to @tobiu on Jul 12, 2025, 8:10 PM
tobiu added the enhancement label on Jul 12, 2025, 8:10 PM
tobiu referenced in commit eaf22d8 - "Feature: Fine-grained Reactivity Control with EffectManager.pause() #7026" on Jul 12, 2025, 8:12 PM
tobiu closed this issue on Jul 12, 2025, 8:13 PM
tobiu added parent issue #6992 on Jul 12, 2025, 8:29 PM