Remove an unnecessary warning
It was impossible to get here because if you enqueue something Also ensure that they're only used in DEV because we will be reading state that is DEV only here.
Sebastian Markbage committed
Jun 18, 2015 at 12:36 UTC
7443f63ae995a01f0b97675a17ca3b0d81bd0ad2
2 files changed
+9
-15
src/renderers/shared/reconciler/ReactUpdateQueue.js
+9
-7
@@ -32,13 +32,15 @@ function enqueueUpdate(internalInstance) {
32
}
33
34
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
35
- warning(
36
- ReactCurrentOwner.current == null,
37
- '%s(...): Cannot update during an existing state transition ' +
38
- '(such as within `render`). Render methods should be a pure function ' +
39
- 'of props and state.',
40
- callerName
41
- );
35
+ if (__DEV__) {
36
+ warning(
37
+ ReactCurrentOwner.current == null,
38
+ '%s(...): Cannot update during an existing state transition ' +
39
+ '(such as within `render`). Render methods should be a pure function ' +
40
+ 'of props and state.',
41
+ callerName
42
+ );
43
+ }
44
45
var internalInstance = ReactInstanceMap.get(publicInstance);
46
if (!internalInstance) {
src/renderers/shared/reconciler/ReactUpdates.js
-8
@@ -13,7 +13,6 @@
13
14
var CallbackQueue = require('CallbackQueue');
15
var PooledClass = require('PooledClass');
16
-var ReactCurrentOwner = require('ReactCurrentOwner');
16
var ReactPerf = require('ReactPerf');
17
var ReactReconciler = require('ReactReconciler');
18
var Transaction = require('Transaction');
@@ -203,13 +202,6 @@ function enqueueUpdate(component) {
202
// verify that that's the case. (This is called by each top-level update
203
// function, like setProps, setState, forceUpdate, etc.; creation and
204
// destruction of top-level components is guarded in ReactMount.)
206
- warning(
207
- ReactCurrentOwner.current == null,
208
- 'enqueueUpdate(): Render methods should be a pure function of props ' +
209
- 'and state; triggering nested component updates from render is not ' +
210
- 'allowed. If necessary, trigger nested updates in ' +
211
- 'componentDidUpdate.'
212
- );
205
206
if (!batchingStrategy.isBatchingUpdates) {
207
batchingStrategy.batchedUpdates(enqueueUpdate, component);