From 6eeb2898f7ad2bdbf87e1c89566359376549a0c2 Mon Sep 17 00:00:00 2001 From: Timothy Yung Date: Tue, 7 Jun 2016 17:23:40 -0700 Subject: [PATCH] Improve error message for components in bad states (missing instance) (#6990) (cherry picked from commit 7988acaa95bb6cd889820ea07c960a824b43e9eb) --- .../shared/stack/reconciler/ReactCompositeComponent.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js b/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js index 4d0c62d62d..735a5b5afc 100644 --- a/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js +++ b/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js @@ -741,6 +741,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;