Skip to content

Commit

Permalink
Move getNextDebugID() to React package.
Browse files Browse the repository at this point in the history
The module, and its internal state, was duplicated in several packages,
leading to duplicate ids when multiple renderers were used.
  • Loading branch information
wacii committed Mar 2, 2017
1 parent a190cfc commit e6f79f1
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions grunt/config/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var shimSharedModules = aliasify.configure({
'react/lib/React': 'react/lib/ReactUMDShim',
'react/lib/ReactCurrentOwner': 'react/lib/ReactCurrentOwnerUMDShim',
'react/lib/ReactComponentTreeHook': 'react/lib/ReactComponentTreeHookUMDShim',
'react/lib/getNextDebugID': 'react/lib/getNextDebugIDUMDShim',
},
});

Expand Down
2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ var moduleMapReact = Object.assign(
'react/lib/checkPropTypes': './checkPropTypes',
'react/lib/ReactComponentTreeHook': './ReactComponentTreeHook',
'react/lib/ReactDebugCurrentFrame': './ReactDebugCurrentFrame',
'react/lib/getNextDebugID': './getNextDebugID',
},
moduleMapBase
);
Expand All @@ -139,6 +140,7 @@ var rendererSharedState = {
'react/lib/checkPropTypes': 'react/lib/checkPropTypes',
'react/lib/ReactComponentTreeHook': 'react/lib/ReactComponentTreeHook',
'react/lib/ReactDebugCurrentFrame': 'react/lib/ReactDebugCurrentFrame',
'react/lib/getNextDebugID': 'react/lib/getNextDebugID',
};

var moduleMapReactDOM = Object.assign(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var ReactCompositeComponent = require('ReactCompositeComponent');
var ReactEmptyComponent = require('ReactEmptyComponent');
var ReactHostComponent = require('ReactHostComponent');

var getNextDebugID = require('getNextDebugID');
var getNextDebugID = require('react/lib/getNextDebugID');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');

Expand Down
2 changes: 1 addition & 1 deletion src/test/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var ReactReconciler = require('ReactReconciler');
var ReactUpdates = require('ReactUpdates');

var emptyObject = require('fbjs/lib/emptyObject');
var getNextDebugID = require('getNextDebugID');
var getNextDebugID = require('react/lib/getNextDebugID');
var invariant = require('fbjs/lib/invariant');

class NoopInternalComponent {
Expand Down
1 change: 1 addition & 0 deletions src/umd/ReactUMDEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if (__DEV__) {
{
// ReactComponentTreeHook should not be included in production.
ReactComponentTreeHook: require('react/lib/ReactComponentTreeHook'),
getNextDebugID: require('react/lib/getNextDebugID'),
}
);
}
Expand Down
1 change: 1 addition & 0 deletions src/umd/ReactWithAddonsUMDEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (__DEV__) {
{
// ReactComponentTreeHook should not be included in production.
ReactComponentTreeHook: require('react/lib/ReactComponentTreeHook'),
getNextDebugID: require('react/lib/getNextDebugID'),
}
);
}
Expand Down
19 changes: 19 additions & 0 deletions src/umd/shims/getNextDebugIDUMDShim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getNextDebugId
*/

/* globals React */

'use strict';

var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

module.exports = ReactInternals.getNextDebugID;

0 comments on commit e6f79f1

Please sign in to comment.