LearnNewsExamplesServices
Frontmatter
id7027
titleFeature: Robust Synchronous Updates for Functional Components
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 12, 2025, 8:23 PM
updatedAtJul 13, 2025, 7:48 PM
githubUrlhttps://github.com/neomjs/neo/issues/7027
authortobiu
commentsCount0
parentIssue6992
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 13, 2025, 7:48 PM

Feature: Robust Synchronous Updates for Functional Components

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

Is your feature request related to a problem? Please describe. Previously, the reactivity system for functional components could lead to infinite loops or unpredictable behavior during VDOM updates due to unintended dependencies and synchronous re-triggering of effects.

Describe the solution you'd like The Neo.functional.component.Base class now supports robust and stable synchronous updates. This has been achieved through a series of architectural improvements:

  • Decoupled VDOM Generation and Application: The vdomEffect now solely focuses on generating the new VDOM structure (createVdom), storing it temporarily. The application of this VDOM to the component's stable vdom object, and the subsequent triggering of updateVdom(), occurs in the onEffectRunStateChange handler.
  • Controlled Dependency Tracking: The EffectManager.pause() and resume() mechanism, utilized within hooks like useConfig(), prevents unintended reactive dependencies (e.g., on ComponentManager.registry) from being created during non-rendering-related operations.
  • Robust Batch Processing: The EffectBatchManager.endBatch() method now correctly handles effect execution by taking a snapshot of pending effects and clearing the queue before running them, preventing synchronous re-queuing and infinite loops within the batch processor.

These changes collectively ensure that functional components update reliably and efficiently in response to reactive config and state changes, without encountering call stack overflows.

Describe alternatives you've considered (None considered, as this is the implemented solution.)

Additional context This represents a significant milestone in the stability and predictability of functional components within Neo.mjs.

Affected Files:

  • src/functional/component/Base.mjs
tobiu assigned to @tobiu on Jul 12, 2025, 8:23 PM
tobiu added the enhancement label on Jul 12, 2025, 8:23 PM
tobiu added parent issue #6992 on Jul 12, 2025, 8:23 PM
tobiu referenced in commit 4b12fb7 - "Feature: Robust Synchronous Updates for Functional Components #7027" on Jul 12, 2025, 8:24 PM
tobiu closed this issue on Jul 13, 2025, 7:48 PM