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
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.
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.
1. Summary
This ticket covers a minor but important enhancement to the
Neo.core.Effectclass to support the functional component hook system.2. Rationale
To allow hooks like
useConfigto identify which component is currently rendering, we needed a way to link an activeEffectback to its owner component. The cleanest, most decoupled way to achieve this was to add an optionalcomponentIdto theEffect's constructor.Since
core.Effectis a new class introduced in the v10 beta series, adding an optional parameter is a safe, non-breaking change.3. Scope & Implementation Plan
Update
EffectConstructor:constructorofNeo.core.Effectto accept an optional second parameter,componentId.componentIdis provided, store it on a publicthis.componentIdproperty on the effect instance.Update
FunctionalBase:Neo.functional.component.Base, update the creation of thevdomEffectto passthis.idas the second argument to theEffectconstructor.4. Definition of Done
Neo.core.Effectconstructor is updated to accept an optionalcomponentId.functional.component.Basecorrectly passes its ID when creating itsvdomEffect.useConfighook to reliably get the current component instance.