@samitouri / QOS-React / commits / e8629667ab

Deduplication of warning messages in nested updates (#11081) (#11113)

Deduplication of warning messages in nested updates (#11081) (#11113)

Anushree Subramani committed Oct 7, 2017 at 03:34 UTC e8629667ab378769c2f3c1e65baa9740368008c0
2 files changed +10 -1
src/renderers/shared/fiber/ReactFiberReconciler.js
+4 -1
@@ -34,6 +34,7 @@ if (__DEV__) {
34 var ReactFiberInstrumentation = require('ReactFiberInstrumentation');
35 var ReactDebugCurrentFiber = require('ReactDebugCurrentFiber');
36 var getComponentName = require('getComponentName');
37 + var didWarnAboutNestedUpdates = false;
38 }
39
40 var {
@@ -214,8 +215,10 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
215 if (__DEV__) {
216 if (
217 ReactDebugCurrentFiber.phase === 'render' &&
217 - ReactDebugCurrentFiber.current !== null
218 + ReactDebugCurrentFiber.current !== null &&
219 + !didWarnAboutNestedUpdates
220 ) {
221 + didWarnAboutNestedUpdates = true;
222 warning(
223 false,
224 'Render methods should be a pure function of props and state; ' +
src/renderers/shared/fiber/ReactFiberScheduler.js
+6
@@ -109,6 +109,8 @@ if (__DEV__) {
109 stopCommitLifeCyclesTimer,
110 } = require('ReactDebugFiberPerf');
111
112 + var didWarnAboutStateTransition = false;
113 +
114 var warnAboutUpdateOnUnmounted = function(
115 instance: React$ComponentType<any>,
116 ) {
@@ -132,6 +134,10 @@ if (__DEV__) {
134 );
135 break;
136 case 'render':
137 + if (didWarnAboutStateTransition) {
138 + return;
139 + }
140 + didWarnAboutStateTransition = true;
141 warning(
142 false,
143 'Cannot update during an existing state transition (such as within ' +