Skip to content

Commit 4d81744

Browse files
committed
Only perform class checks on initial mount
Avoids firing warnings multiple times
1 parent 9145f40 commit 4d81744

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/renderers/shared/fiber/ReactFiberClassComponent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ module.exports = function(
294294
: emptyObject;
295295
const instance = new ctor(props, context);
296296
adoptClassInstance(workInProgress, instance);
297-
checkClassInstance(workInProgress);
298297

299298
// Cache unmasked context so we can avoid recreating masked context unless necessary.
300299
// ReactFiberContext usually updates this cache but can't for newly-created instances.
@@ -310,6 +309,10 @@ module.exports = function(
310309
workInProgress: Fiber,
311310
priorityLevel: PriorityLevel,
312311
): void {
312+
if (__DEV__) {
313+
checkClassInstance(workInProgress);
314+
}
315+
313316
const instance = workInProgress.stateNode;
314317
const state = instance.state || null;
315318

0 commit comments

Comments
 (0)