From d51981eeead4386445a9d8570910346509ed8cf0 Mon Sep 17 00:00:00 2001 From: Dustan Kasten Date: Wed, 18 May 2016 22:05:25 -0400 Subject: [PATCH] Move instrumentation to renderers/shared. Closes #6797 --- src/isomorphic/modern/class/ReactComponent.js | 9 --------- src/{isomorphic => renderers/shared}/ReactDebugTool.js | 0 .../shared}/ReactInstrumentation.js | 0 src/{isomorphic => renderers/shared}/ReactPerf.js | 0 .../shared}/__tests__/ReactDebugTool-test.js | 0 .../shared}/__tests__/ReactPerf-test.js | 0 .../shared}/devtools/ReactComponentTreeDevtool.js | 0 .../devtools/ReactHostOperationHistoryDevtool.js | 0 .../devtools/ReactInvalidSetStateWarningDevTool.js | 0 .../__tests__/ReactComponentTreeDevtool-test.js | 0 .../__tests__/ReactComponentTreeDevtool-test.native.js | 0 .../__tests__/ReactHostOperationHistoryDevtool-test.js | 0 .../shared/stack/reconciler/ReactUpdateQueue.js | 10 ++++++++++ 13 files changed, 10 insertions(+), 9 deletions(-) rename src/{isomorphic => renderers/shared}/ReactDebugTool.js (100%) rename src/{isomorphic => renderers/shared}/ReactInstrumentation.js (100%) rename src/{isomorphic => renderers/shared}/ReactPerf.js (100%) rename src/{isomorphic => renderers/shared}/__tests__/ReactDebugTool-test.js (100%) rename src/{isomorphic => renderers/shared}/__tests__/ReactPerf-test.js (100%) rename src/{isomorphic => renderers/shared}/devtools/ReactComponentTreeDevtool.js (100%) rename src/{isomorphic => renderers/shared}/devtools/ReactHostOperationHistoryDevtool.js (100%) rename src/{isomorphic => renderers/shared}/devtools/ReactInvalidSetStateWarningDevTool.js (100%) rename src/{isomorphic => renderers/shared}/devtools/__tests__/ReactComponentTreeDevtool-test.js (100%) rename src/{isomorphic => renderers/shared}/devtools/__tests__/ReactComponentTreeDevtool-test.native.js (100%) rename src/{isomorphic => renderers/shared}/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js (100%) diff --git a/src/isomorphic/modern/class/ReactComponent.js b/src/isomorphic/modern/class/ReactComponent.js index a775abd67dda6..b93da63e94cf9 100644 --- a/src/isomorphic/modern/class/ReactComponent.js +++ b/src/isomorphic/modern/class/ReactComponent.js @@ -12,7 +12,6 @@ 'use strict'; var ReactNoopUpdateQueue = require('ReactNoopUpdateQueue'); -var ReactInstrumentation = require('ReactInstrumentation'); var canDefineProperty = require('canDefineProperty'); var emptyObject = require('emptyObject'); @@ -66,14 +65,6 @@ ReactComponent.prototype.setState = function(partialState, callback) { 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.' ); - if (__DEV__) { - ReactInstrumentation.debugTool.onSetState(); - warning( - partialState != null, - 'setState(...): You passed an undefined or null state object; ' + - 'instead, use forceUpdate().' - ); - } this.updater.enqueueSetState(this, partialState); if (callback) { this.updater.enqueueCallback(this, callback, 'setState'); diff --git a/src/isomorphic/ReactDebugTool.js b/src/renderers/shared/ReactDebugTool.js similarity index 100% rename from src/isomorphic/ReactDebugTool.js rename to src/renderers/shared/ReactDebugTool.js diff --git a/src/isomorphic/ReactInstrumentation.js b/src/renderers/shared/ReactInstrumentation.js similarity index 100% rename from src/isomorphic/ReactInstrumentation.js rename to src/renderers/shared/ReactInstrumentation.js diff --git a/src/isomorphic/ReactPerf.js b/src/renderers/shared/ReactPerf.js similarity index 100% rename from src/isomorphic/ReactPerf.js rename to src/renderers/shared/ReactPerf.js diff --git a/src/isomorphic/__tests__/ReactDebugTool-test.js b/src/renderers/shared/__tests__/ReactDebugTool-test.js similarity index 100% rename from src/isomorphic/__tests__/ReactDebugTool-test.js rename to src/renderers/shared/__tests__/ReactDebugTool-test.js diff --git a/src/isomorphic/__tests__/ReactPerf-test.js b/src/renderers/shared/__tests__/ReactPerf-test.js similarity index 100% rename from src/isomorphic/__tests__/ReactPerf-test.js rename to src/renderers/shared/__tests__/ReactPerf-test.js diff --git a/src/isomorphic/devtools/ReactComponentTreeDevtool.js b/src/renderers/shared/devtools/ReactComponentTreeDevtool.js similarity index 100% rename from src/isomorphic/devtools/ReactComponentTreeDevtool.js rename to src/renderers/shared/devtools/ReactComponentTreeDevtool.js diff --git a/src/isomorphic/devtools/ReactHostOperationHistoryDevtool.js b/src/renderers/shared/devtools/ReactHostOperationHistoryDevtool.js similarity index 100% rename from src/isomorphic/devtools/ReactHostOperationHistoryDevtool.js rename to src/renderers/shared/devtools/ReactHostOperationHistoryDevtool.js diff --git a/src/isomorphic/devtools/ReactInvalidSetStateWarningDevTool.js b/src/renderers/shared/devtools/ReactInvalidSetStateWarningDevTool.js similarity index 100% rename from src/isomorphic/devtools/ReactInvalidSetStateWarningDevTool.js rename to src/renderers/shared/devtools/ReactInvalidSetStateWarningDevTool.js diff --git a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js b/src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js similarity index 100% rename from src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.js rename to src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js diff --git a/src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js b/src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.native.js similarity index 100% rename from src/isomorphic/devtools/__tests__/ReactComponentTreeDevtool-test.native.js rename to src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.native.js diff --git a/src/isomorphic/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js b/src/renderers/shared/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js similarity index 100% rename from src/isomorphic/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js rename to src/renderers/shared/devtools/__tests__/ReactHostOperationHistoryDevtool-test.js diff --git a/src/renderers/shared/stack/reconciler/ReactUpdateQueue.js b/src/renderers/shared/stack/reconciler/ReactUpdateQueue.js index 65bdd490525a4..94369f43348da 100644 --- a/src/renderers/shared/stack/reconciler/ReactUpdateQueue.js +++ b/src/renderers/shared/stack/reconciler/ReactUpdateQueue.js @@ -13,6 +13,7 @@ var ReactCurrentOwner = require('ReactCurrentOwner'); var ReactInstanceMap = require('ReactInstanceMap'); +var ReactInstrumentation = require('ReactInstrumentation'); var ReactUpdates = require('ReactUpdates'); var invariant = require('invariant'); @@ -219,6 +220,15 @@ var ReactUpdateQueue = { * @internal */ enqueueSetState: function(publicInstance, partialState) { + if (__DEV__) { + ReactInstrumentation.debugTool.onSetState(); + warning( + partialState != null, + 'setState(...): You passed an undefined or null state object; ' + + 'instead, use forceUpdate().' + ); + } + var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'setState'