Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YieldWrapper still passed in children when there are no child nodes #19

Closed
jameshoward opened this issue Apr 11, 2018 · 2 comments
Closed

Comments

@jameshoward
Copy link

If there are no child nodes of the component (i.e. it is not being used as a block), there is still a children array passed to the React.createElement containing a YieldWrapper component. We have a component that throws an error (beyond our control) when passed children.

Would it make sense to only create the children/YieldWrapper when childNodes.length > 0 like below? Happy to send a PR.

    let children = props.children;
    if (!children) {
      const childNodes = get(this, 'element.childNodes');
      if (childNodes.length > 0) {
        children = [
          React.createElement(YieldWrapper, {
            key: get(this, 'elementId'),
            nodes: [...childNodes]
          })
        ];
      }
    }
@alexgb
Copy link
Contributor

alexgb commented May 17, 2018

@jameshoward Yes, I think this makes sense. A PR would be great. Thank you.

@pswai
Copy link
Contributor

pswai commented Jul 4, 2018

@alexgb @jameshoward I am working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants