Nested objects emitting `undefined` and not `Object.assign` in destructuring (New as of 0.15)
Hi! There's a pretty serious bug that's new as of 0.15.
Given this:
class MyThing extends Component {
render(props) {
return <div one={"This Works"} {...props}></div>;
}
};
class MyOtherThing extends Component {
render(props) {
return <MyThing two={"This Fails"} {...props}></MyThing>;
}
}
It outputs this:
var MyThing = (function (Component) {
function MyThing () {
Component.apply(this, arguments);
}
if ( Component ) MyThing.__proto__ = Component;
MyThing.prototype = Object.create( Component && Component.prototype );
MyThing.prototype.constructor = MyThing;
MyThing.prototype.render = function render (props) {
return React.createElement( 'div', Object.assign({}, { one: "This Works" }, props));
};
return MyThing;
}(Component));;
var MyOtherThing = (function (Component) {
function MyOtherThing () {
Component.apply(this, arguments);
}
if ( Component ) MyOtherThing.__proto__ = Component;
MyOtherThing.prototype = Object.create( Component && Component.prototype );
MyOtherThing.prototype.constructor = MyOtherThing;
MyOtherThing.prototype.render = function render (props) {
return React.createElement( MyThing, undefined({}, { two: "This Fails" }, props));
};
return MyOtherThing;
}(Component));
Notice that in MyOtherThing.prototype.render
, it's returning React.createElement( MyThing, undefined(
and not React.createElement( MyThing, Object.assign
, as it does earlier in the code. I am setting --objectAssign="Object.assign"
on the command line to the buble tool.
This is brand new as of 0.15.0
. Reverting to 0.14.3
fixes it.