Skip to content

Commit 21826e2

Browse files
committed
Move getNextDebugID() to React package.
The module, and its internal state, was duplicated in several packages, leading to duplicate ids when multiple renderers were used.
1 parent fc46337 commit 21826e2

File tree

9 files changed

+35
-2
lines changed

9 files changed

+35
-2
lines changed

grunt/config/browserify.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var shimSharedModules = aliasify.configure({
1818
'react/lib/React': 'react/lib/ReactUMDShim',
1919
'react/lib/ReactCurrentOwner': 'react/lib/ReactCurrentOwnerUMDShim',
2020
'react/lib/ReactComponentTreeHook': 'react/lib/ReactComponentTreeHookUMDShim',
21+
'react/lib/getNextDebugID': 'react/lib/getNextDebugIDUMDShim',
2122
},
2223
});
2324

gulpfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ var moduleMapReact = Object.assign(
129129
'react/lib/checkPropTypes': './checkPropTypes',
130130
'react/lib/ReactComponentTreeHook': './ReactComponentTreeHook',
131131
'react/lib/ReactDebugCurrentFrame': './ReactDebugCurrentFrame',
132+
'react/lib/getNextDebugID': './getNextDebugID',
132133
},
133134
moduleMapBase
134135
);
@@ -141,6 +142,7 @@ var rendererSharedState = {
141142
'react/lib/checkPropTypes': 'react/lib/checkPropTypes',
142143
'react/lib/ReactComponentTreeHook': 'react/lib/ReactComponentTreeHook',
143144
'react/lib/ReactDebugCurrentFrame': 'react/lib/ReactDebugCurrentFrame',
145+
'react/lib/getNextDebugID': 'react/lib/getNextDebugID',
144146
};
145147

146148
var moduleMapReactDOM = Object.assign(
File renamed without changes.

src/node_modules/react/lib/getNextDebugID.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderers/shared/stack/reconciler/instantiateReactComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var ReactCompositeComponent = require('ReactCompositeComponent');
1515
var ReactEmptyComponent = require('ReactEmptyComponent');
1616
var ReactHostComponent = require('ReactHostComponent');
1717

18-
var getNextDebugID = require('getNextDebugID');
18+
var getNextDebugID = require('react/lib/getNextDebugID');
1919
var invariant = require('fbjs/lib/invariant');
2020
var warning = require('fbjs/lib/warning');
2121

src/test/ReactShallowRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var ReactReconciler = require('ReactReconciler');
2020
var ReactUpdates = require('ReactUpdates');
2121

2222
var emptyObject = require('fbjs/lib/emptyObject');
23-
var getNextDebugID = require('getNextDebugID');
23+
var getNextDebugID = require('react/lib/getNextDebugID');
2424
var invariant = require('fbjs/lib/invariant');
2525

2626
class NoopInternalComponent {

src/umd/ReactUMDEntry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if (__DEV__) {
2626
{
2727
// ReactComponentTreeHook should not be included in production.
2828
ReactComponentTreeHook: require('react/lib/ReactComponentTreeHook'),
29+
getNextDebugID: require('react/lib/getNextDebugID'),
2930
}
3031
);
3132
}

src/umd/ReactWithAddonsUMDEntry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ if (__DEV__) {
2727
{
2828
// ReactComponentTreeHook should not be included in production.
2929
ReactComponentTreeHook: require('react/lib/ReactComponentTreeHook'),
30+
getNextDebugID: require('react/lib/getNextDebugID'),
3031
}
3132
);
3233
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @providesModule getNextDebugId
10+
*/
11+
12+
/* globals React */
13+
14+
'use strict';
15+
16+
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
17+
18+
module.exports = ReactInternals.getNextDebugID;
19+

0 commit comments

Comments
 (0)