Add more helpful invariant if you're updating an unrendered component
Clay Allsopp committed
Aug 26, 2013 at 10:42 UTC
88faef3ba9042ccd30ce5ab064a73ca6e3ae5c21
1 file changed
+5
src/core/ReactCompositeComponent.js
+5
@@ -726,6 +726,11 @@ var ReactCompositeComponentMixin = {
726
ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);
727
var currentComponent = this._renderedComponent;
728
var nextComponent = this._renderValidatedComponent();
729
+ invariant(
730
+ typeof currentComponent !== 'undefined',
731
+ 'updateComponent(...): You are attempting to update an unrendered ' +
732
+ 'component.'
733
+ );
734
if (currentComponent.constructor === nextComponent.constructor) {
735
currentComponent.receiveProps(nextComponent.props, transaction);
736
} else {