mirror of
https://github.com/facebook/react.git
synced 2026-02-26 18:58:05 +00:00
Prior to this, React was using a nextDebugID variable that was locally scoped to both `instantiateReactComponent` and `ReactShallowRenderer`. This caused problems when the debugIDs would collide, the `itemMap` in `ReactComponentTreeHook` would be overwritten and tests would fail with the message "Expected onBeforeMountComponent() parent and onSetChildren() to be consistent". This change shares the debugID with both modules thus preventing any collisions in the future.
22 lines
485 B
JavaScript
22 lines
485 B
JavaScript
/**
|
|
* 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
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var nextDebugID = 1;
|
|
|
|
function getNextDebugID(): number {
|
|
return nextDebugID++;
|
|
}
|
|
|
|
module.exports = getNextDebugID;
|