From 4d8174480c6daa2ec49a932b54705d73ba40a398 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 1 May 2017 15:47:18 -0700 Subject: [PATCH] Only perform class checks on initial mount Avoids firing warnings multiple times --- src/renderers/shared/fiber/ReactFiberClassComponent.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderers/shared/fiber/ReactFiberClassComponent.js b/src/renderers/shared/fiber/ReactFiberClassComponent.js index d97e5b5aa1..ba6425308e 100644 --- a/src/renderers/shared/fiber/ReactFiberClassComponent.js +++ b/src/renderers/shared/fiber/ReactFiberClassComponent.js @@ -294,7 +294,6 @@ module.exports = function( : emptyObject; const instance = new ctor(props, context); adoptClassInstance(workInProgress, instance); - checkClassInstance(workInProgress); // Cache unmasked context so we can avoid recreating masked context unless necessary. // ReactFiberContext usually updates this cache but can't for newly-created instances. @@ -310,6 +309,10 @@ module.exports = function( workInProgress: Fiber, priorityLevel: PriorityLevel, ): void { + if (__DEV__) { + checkClassInstance(workInProgress); + } + const instance = workInProgress.stateNode; const state = instance.state || null;