Skip to content

Commit

Permalink
Improve error message for components in bad states (missing instance)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungsters committed Jun 7, 2016
1 parent ccd26ee commit 95fd9b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/renderers/shared/stack/reconciler/ReactCompositeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ var ReactCompositeComponentMixin = {
return;
}
var inst = this._instance;
invariant(
inst != null,
'Attempted to unmount component `%s` that has already been unmounted ' +
'(or failed to mount).',
this.getName() || 'ReactCompositeComponent'
);

if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
inst._calledComponentWillUnmount = true;
Expand Down Expand Up @@ -741,6 +747,13 @@ var ReactCompositeComponentMixin = {
nextUnmaskedContext
) {
var inst = this._instance;
invariant(
inst != null,
'Attempted to update component `%s` that has already been unmounted ' +
'(or failed to mount).',
this.getName() || 'ReactCompositeComponent'
);

var willReceive = false;
var nextContext;
var nextProps;
Expand Down

0 comments on commit 95fd9b3

Please sign in to comment.