Added component displayName to warning message in ReactUpdateQueue.js
Edvin Erikson committed
May 20, 2015 at 17:43 UTC
58edaab705e3ea58ac72509e9e2541101179a415
3 files changed
+14
-9
src/renderers/shared/reconciler/ReactUpdateQueue.js
+5
-3
@@ -49,10 +49,12 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
49
warning(
50
!callerName,
51
'%s(...): Can only update a mounted or mounting component. ' +
52
- 'This usually means you called %s() on an unmounted ' +
53
- 'component. This is a no-op.',
52
+ 'This usually means you called %s() on an unmounted component. ' +
53
+ 'Please check the code for the %s component. ' +
54
+ 'This is a no-op.',
55
callerName,
55
- callerName
56
+ callerName,
57
+ publicInstance.constructor.displayName
58
);
59
}
60
return null;
src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
+2
-2
@@ -257,7 +257,8 @@ describe('ReactComponentLifeCycle', function() {
257
expect(console.error.argsForCall[0][0]).toBe(
258
'Warning: setState(...): Can only update a mounted or ' +
259
'mounting component. This usually means you called setState() on an ' +
260
- 'unmounted component. This is a no-op.'
260
+ 'unmounted component. Please check the code for the ' +
261
+ 'StatefulComponent component. This is a no-op.'
262
);
263
});
264
@@ -636,4 +637,3 @@ describe('ReactComponentLifeCycle', function() {
637
]);
638
});
639
});
639
-
src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+7
-4
@@ -276,8 +276,9 @@ describe('ReactCompositeComponent', function() {
276
expect(console.error.calls.length).toBe(1);
277
expect(console.error.argsForCall[0][0]).toBe(
278
'Warning: forceUpdate(...): Can only update a mounted or ' +
279
- 'mounting component. This usually means you called forceUpdate() on ' +
280
- 'an unmounted component. This is a no-op.'
279
+ 'mounting component. This usually means you called forceUpdate() on an ' +
280
+ 'unmounted component. Please check the code for the ' +
281
+ 'Component component. This is a no-op.'
282
);
283
});
284
@@ -308,7 +309,8 @@ describe('ReactCompositeComponent', function() {
309
expect(console.error.argsForCall[0][0]).toBe(
310
'Warning: setState(...): Can only update a mounted or ' +
311
'mounting component. This usually means you called setState() on an ' +
311
- 'unmounted component. This is a no-op.'
312
+ 'unmounted component. Please check the code for the ' +
313
+ 'Component component. This is a no-op.'
314
);
315
});
316
@@ -372,7 +374,8 @@ describe('ReactCompositeComponent', function() {
374
expect(console.error.argsForCall[0][0]).toBe(
375
'Warning: setProps(...): Can only update a mounted or ' +
376
'mounting component. This usually means you called setProps() on an ' +
375
- 'unmounted component. This is a no-op.'
377
+ 'unmounted component. Please check the code for the ' +
378
+ 'Component component. This is a no-op.'
379
);
380
});
381