diff --git a/src/isomorphic/classic/types/checkReactTypeSpec.js b/src/isomorphic/classic/types/checkReactTypeSpec.js index 84211727fa977..196d387a9cbbb 100644 --- a/src/isomorphic/classic/types/checkReactTypeSpec.js +++ b/src/isomorphic/classic/types/checkReactTypeSpec.js @@ -11,27 +11,13 @@ 'use strict'; +var ReactComponentTreeDevtoolDev = require('ReactComponentTreeDevtoolDev'); var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames'); var ReactPropTypesSecret = require('ReactPropTypesSecret'); var invariant = require('invariant'); var warning = require('warning'); -var ReactComponentTreeDevtool; - -if ( - typeof process !== 'undefined' && - process.env && - process.env.NODE_ENV === 'test' -) { - // Temporary hack. - // Inline requires don't work well with Jest: - // https://github.com/facebook/react/issues/7240 - // Remove the inline requires when we don't need them anymore: - // https://github.com/facebook/react/pull/7178 - ReactComponentTreeDevtool = require('ReactComponentTreeDevtool') -} - var loggedTypeFailures = {}; /** @@ -88,13 +74,10 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element, var componentStackInfo = ''; if (__DEV__) { - if (!ReactComponentTreeDevtool) { - ReactComponentTreeDevtool = require('ReactComponentTreeDevtool'); - } if (debugID !== null) { - componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID); + componentStackInfo = ReactComponentTreeDevtoolDev.getStackAddendumByID(debugID); } else if (element !== null) { - componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element); + componentStackInfo = ReactComponentTreeDevtoolDev.getCurrentStackAddendum(element); } } diff --git a/src/renderers/shared/stack/reconciler/ReactChildReconciler.js b/src/renderers/shared/stack/reconciler/ReactChildReconciler.js index 0d94b766d8ded..8ebeebd074cf0 100644 --- a/src/renderers/shared/stack/reconciler/ReactChildReconciler.js +++ b/src/renderers/shared/stack/reconciler/ReactChildReconciler.js @@ -11,6 +11,7 @@ 'use strict'; +var ReactComponentTreeDevtoolDev = require('ReactComponentTreeDevtoolDev'); var ReactReconciler = require('ReactReconciler'); var instantiateReactComponent = require('instantiateReactComponent'); @@ -19,35 +20,17 @@ var shouldUpdateReactComponent = require('shouldUpdateReactComponent'); var traverseAllChildren = require('traverseAllChildren'); var warning = require('warning'); -var ReactComponentTreeDevtool; - -if ( - typeof process !== 'undefined' && - process.env && - process.env.NODE_ENV === 'test' -) { - // Temporary hack. - // Inline requires don't work well with Jest: - // https://github.com/facebook/react/issues/7240 - // Remove the inline requires when we don't need them anymore: - // https://github.com/facebook/react/pull/7178 - ReactComponentTreeDevtool = require('ReactComponentTreeDevtool') -} - function instantiateChild(childInstances, child, name, selfDebugID) { // We found a component instance. var keyUnique = (childInstances[name] === undefined); if (__DEV__) { - if (!ReactComponentTreeDevtool) { - ReactComponentTreeDevtool = require('ReactComponentTreeDevtool'); - } warning( keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), - ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID) + ReactComponentTreeDevtoolDev.getStackAddendumByID(selfDebugID) ); } if (child != null && keyUnique) {