mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Only perform class checks on initial mount
Avoids firing warnings multiple times
This commit is contained in:
1 parent
9145f40eb8
commit
4d8174480c
1 file changed
+4
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user