Skip to content

Commit

Permalink
revert "Inline dev-only requires (facebook#7188)"
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyan Zhang committed Jul 25, 2016
1 parent e0595bb commit 127c188
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 39 deletions.
23 changes: 3 additions & 20 deletions src/isomorphic/classic/types/checkReactTypeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

/**
Expand Down Expand Up @@ -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);
}
}

Expand Down
21 changes: 2 additions & 19 deletions src/renderers/shared/stack/reconciler/ReactChildReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

'use strict';

var ReactComponentTreeDevtoolDev = require('ReactComponentTreeDevtoolDev');
var ReactReconciler = require('ReactReconciler');

var instantiateReactComponent = require('instantiateReactComponent');
Expand All @@ -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) {
Expand Down

0 comments on commit 127c188

Please sign in to comment.