LearnNewsExamplesServices
Frontmatter
id7015
titleEnhance `Neo.core.Effect` Constructor
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 11, 2025, 12:27 PM
updatedAtJul 11, 2025, 12:34 PM
githubUrlhttps://github.com/neomjs/neo/issues/7015
authortobiu
commentsCount0
parentIssue6992
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 11, 2025, 12:34 PM

Enhance Neo.core.Effect Constructor

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

1. Summary

This ticket covers a minor but important enhancement to the Neo.core.Effect class to support the functional component hook system.

2. Rationale

To allow hooks like useConfig to identify which component is currently rendering, we needed a way to link an active Effect back to its owner component. The cleanest, most decoupled way to achieve this was to add an optional componentId to the Effect's constructor.

Since core.Effect is a new class introduced in the v10 beta series, adding an optional parameter is a safe, non-breaking change.

3. Scope & Implementation Plan

  1. Update Effect Constructor:

    • Modify the constructor of Neo.core.Effect to accept an optional second parameter, componentId.
    • If componentId is provided, store it on a public this.componentId property on the effect instance.
  2. Update FunctionalBase:

    • In Neo.functional.component.Base, update the creation of the vdomEffect to pass this.id as the second argument to the Effect constructor.

4. Definition of Done

  • The Neo.core.Effect constructor is updated to accept an optional componentId.
  • functional.component.Base correctly passes its ID when creating its vdomEffect.
  • This change enables the useConfig hook to reliably get the current component instance.
tobiu assigned to @tobiu on Jul 11, 2025, 12:27 PM
tobiu added parent issue #6992 on Jul 11, 2025, 12:27 PM
tobiu added the enhancement label on Jul 11, 2025, 12:27 PM
tobiu referenced in commit ddbd6eb - "Enhance Neo.core.Effect Constructor #7015" on Jul 11, 2025, 12:34 PM
tobiu closed this issue on Jul 11, 2025, 12:34 PM