@@ -118,19 +118,34 @@ if (__DEV__) {
118
118
} = require ( 'ReactDebugFiberPerf' ) ;
119
119
120
120
var didWarnAboutStateTransition = false ;
121
+ var ownerHasNoopWarning = { } ;
121
122
122
123
var warnAboutUpdateOnUnmounted = function (
123
124
instance : React$ComponentType < any > ,
124
125
) {
125
126
const ctor = instance . constructor ;
127
+ const currentComponent =
128
+ ( ctor && ( ctor . displayName || ctor . name ) ) || 'ReactClass' ;
129
+ const currentComponentErrorInfo =
130
+ 'Can only update a mounted or mounting ' +
131
+ 'component. This usually means you called setState, replaceState, ' +
132
+ 'or forceUpdate on an unmounted component. This is a no-op.\n\nPlease ' +
133
+ 'check the code for the ' +
134
+ currentComponent +
135
+ ' component.' ;
136
+
137
+ if ( ownerHasNoopWarning [ currentComponentErrorInfo ] ) {
138
+ return ;
139
+ }
126
140
warning (
127
141
false ,
128
- 'Can only update a mounted or mounting component. This usually means ' +
129
- 'you called setState, replaceState, or forceUpdate on an unmounted ' +
130
- 'component. This is a no-op.\n\nPlease check the code for the ' +
131
- '%s component.' ,
132
- ( ctor && ( ctor . displayName || ctor . name ) ) || 'ReactClass' ,
142
+ 'Can only update a mounted or mounting ' +
143
+ 'component. This usually means you called setState, replaceState, ' +
144
+ 'or forceUpdate on an unmounted component. This is a no-op.\n\nPlease ' +
145
+ 'check the code for the %s component.' ,
146
+ currentComponent ,
133
147
) ;
148
+ ownerHasNoopWarning [ currentComponentErrorInfo ] = true ;
134
149
} ;
135
150
136
151
var warnAboutInvalidUpdates = function ( instance : React$ComponentType < any > ) {
0 commit comments