move children prop pushing to after props to ensure correct order - fixes #2395
This commit is contained in:
@@ -42,14 +42,6 @@ export default function ({ types: t }) {
|
||||
objProps.push(t.objectProperty(key, value));
|
||||
}
|
||||
|
||||
if (node.children.length) {
|
||||
let children = t.react.buildChildren(node);
|
||||
if (children.length) {
|
||||
children = children.length === 1 ? children[0] : t.arrayExpression(children);
|
||||
pushProp(props.properties, t.identifier("children"), children);
|
||||
}
|
||||
}
|
||||
|
||||
// props
|
||||
for (let attr of (open.attributes: Array<Object>)) {
|
||||
if (isJSXAttributeOfName(attr, "key")) {
|
||||
@@ -61,6 +53,14 @@ export default function ({ types: t }) {
|
||||
}
|
||||
}
|
||||
|
||||
if (node.children.length) {
|
||||
let children = t.react.buildChildren(node);
|
||||
if (children.length) {
|
||||
children = children.length === 1 ? children[0] : t.arrayExpression(children);
|
||||
pushProp(props.properties, t.identifier("children"), children);
|
||||
}
|
||||
}
|
||||
|
||||
if (isComponent) {
|
||||
props = t.callExpression(file.addHelper("defaultProps"), [t.memberExpression(type, t.identifier("defaultProps")), props]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user