LearnNewsExamplesServices
Frontmatter
id5045
titlecontainer.Base: mergeConfig() is causing issues in the latest version
stateClosed
labels
enhancement
assigneestobiu
createdAtOct 19, 2023, 6:35 PM
updatedAtOct 19, 2023, 6:37 PM
githubUrlhttps://github.com/neomjs/neo/issues/5045
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 19, 2023, 6:37 PM

container.Base: mergeConfig() is causing issues in the latest version

Closed v8.1.0 enhancement
tobiu
tobiu commented on Oct 19, 2023, 6:35 PM

regression issue.

old code:

    mergeConfig(...args) {
        let me     = this,
            config = super.mergeConfig(...args);

        // avoid any interference on prototype level
        // does not clone existing Neo instances

        if (config.itemDefaults) {
            me._itemDefaults = Neo.clone(config.itemDefaults, true, true);
            delete config.itemDefaults
        }

        if (config.items) {
            me._items = Neo.clone(config.items, true, true);
            delete config.items
        }

        return config
    }

new code:

    mergeConfig(...args) {
        let me     = this,
            config = super.mergeConfig(...args);

        // avoid any interference on prototype level
        // does not clone existing Neo instances

        if (config.itemDefaults) {
            me._itemDefaults = Neo.clone(config.itemDefaults, true, true);
            delete config.itemDefaults
        }

        if (config.items) {
            // If we are passed an object, merge the class's own items object into it
            me.items = Neo.typeOf(config.items) === 'Object' ?
                Neo.merge(Neo.clone(me.constructor.config.items), config.items) : config.items;
            delete config.items
        }

        return config
    }

while we do have a new beforeSetItems() method, the initial cloning part got lost.

tobiu added the enhancement label on Oct 19, 2023, 6:35 PM
tobiu assigned to @tobiu on Oct 19, 2023, 6:35 PM
tobiu referenced in commit 4e59070 - "container.Base: mergeConfig() is causing issues in the latest version #5045" on Oct 19, 2023, 6:37 PM
tobiu closed this issue on Oct 19, 2023, 6:37 PM
tobiu referenced in commit 84f4933 - "v6.9.2 (#5048) on Oct 19, 2023, 8:25 PM