@samitouri / QOS-React-2 / commits / 4d8174480c

Only perform class checks on initial mount

Avoids firing warnings multiple times

Andrew Clark committed May 1, 2017 at 15:47 UTC 4d8174480c6daa2ec49a932b54705d73ba40a398
1 file changed +4 -1
src/renderers/shared/fiber/ReactFiberClassComponent.js
+4 -1
@@ -294,7 +294,6 @@ module.exports = function(
294 : emptyObject;
295 const instance = new ctor(props, context);
296 adoptClassInstance(workInProgress, instance);
297 - checkClassInstance(workInProgress);
297
298 // Cache unmasked context so we can avoid recreating masked context unless necessary.
299 // ReactFiberContext usually updates this cache but can't for newly-created instances.
@@ -310,6 +309,10 @@ module.exports = function(
309 workInProgress: Fiber,
310 priorityLevel: PriorityLevel,
311 ): void {
312 + if (__DEV__) {
313 + checkClassInstance(workInProgress);
314 + }
315 +
316 const instance = workInProgress.stateNode;
317 const state = instance.state || null;
318