LearnNewsExamplesServices
Frontmatter
id4003
titlemanager.Component: getChildren() => smarter logic required
stateClosed
labels
enhancement
assigneestobiu
createdAtFeb 7, 2023, 2:48 PM
updatedAtFeb 7, 2023, 3:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/4003
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 7, 2023, 3:08 PM

manager.Component: getChildren() => smarter logic required

Closed v8.1.0 enhancement
tobiu
tobiu commented on Feb 7, 2023, 2:48 PM

the original implementation is really old to be fair:

getChildren(component) {
    let childComponents = [],
        childNodes      = VNodeUtil.getChildIds(component.vnode),
        childComponent;

    childNodes.forEach(node => {
        childComponent = this.get(node);

        if (childComponent) {
            childComponents.push(childComponent);
        }
    });

    return childComponents;
}

it is parsing the vnode, which does not exist before a component has been rendered. instead, we want to search the collection recursively for parentId matches.

tobiu added the enhancement label on Feb 7, 2023, 2:48 PM
tobiu assigned to @tobiu on Feb 7, 2023, 2:48 PM
tobiu
tobiu Feb 7, 2023, 3:07 PM

the vnode logic is actually still needed inside component.Base. i added a new method called getChildComponents() and will use it inside the form.Container logic.

tobiu referenced in commit 3f5cb59 - "manager.Component: getChildren() => smarter logic required #4003" on Feb 7, 2023, 3:07 PM
tobiu closed this issue on Feb 7, 2023, 3:08 PM