LearnNewsExamplesServices
Frontmatter
id7080
titleFeature Request: Refactor `core.Effect` to use new constructor signature
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 18, 2025, 1:05 PM
updatedAtJul 18, 2025, 1:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/7080
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 18, 2025, 1:30 PM

Feature Request: Refactor core.Effect to use new constructor signature

Closed v10.0.0-beta.6 enhancement
tobiu
tobiu commented on Jul 18, 2025, 1:05 PM

Summary

The core.Effect constructor has been improved. This ticket tracks the work to update all new Effect() calls across the codebase to use the new, clearer single-object signature: new Effect({ fn: ..., ... }).

Refactoring Targets

  1. src/functional/component/Base.mjs: Update me.vdomEffect in the constructor.
    // from
    me.vdomEffect = new Effect(() => {
        me[hookIndexSymbol]        = 0;
        me[pendingDomEventsSymbol] = []; // Clear pending events for new render
        me[vdomToApplySymbol]      = me.createVdom(me, me.data)
    }, me.id, {
        id   : me.id,
        fn   : me.onEffectRunStateChange,
        scope: me
    });

    // to
    me.vdomEffect = new Effect({
        fn: () => {
            me[hookIndexSymbol]        = 0;
            me[pendingDomEventsSymbol] = []; // Clear pending events for new render
            me[vdomToApplySymbol]      = me.createVdom(me, me.data);
        },
        componentId: me.id,
        subscriber: {
            id   : me.id,
            fn   : me.onEffectRunStateChange,
            scope: me
        }
    });
  1. src/state/Provider.mjs: Update effects in afterSetFormulas() and createBinding().
    // from
    const effect = new Effect(() => { ... }, {lazy: true});

    // to
    const effect = new Effect({
        fn: () => { ... },
        lazy: true
    });

Acceptance Criteria

  • All new Effect() calls are refactored to use the single config object signature.
  • All relevant tests continue to pass.
tobiu assigned to @tobiu on Jul 18, 2025, 1:05 PM
tobiu added the enhancement label on Jul 18, 2025, 1:05 PM
tobiu referenced in commit 0ae0680 - "Feature Request: Refactor core.Effect to use new constructor signature #7080" on Jul 18, 2025, 1:20 PM
tobiu referenced in commit 1b1f541 - "#7080 comments, neo export" on Jul 18, 2025, 1:28 PM
tobiu closed this issue on Jul 18, 2025, 1:30 PM