@samitouri / QOS-React / commits / 0e976e136c

Consolidate hook events (#7472)

* Remove onBeforeMountComponent hook event It is unnecessary. We now pass the element as part of onInstantiateComponent, and it can't change before mounting. * Remove onComponentHasMounted hook event It is unused after #7410. * Replace on(Begin|End)ReconcilerTimer hook events We already have onBeforeUpdateComponent. Let's just have on(Before?)(Mount|Update|Unmount)Component and stick with them. This removes double event dispatches in some hot spots. * Remove onComponentHasUpdated hook The tests still pass so presumably it was not necessary. * Add missing __DEV__ to TestUtils code * Replace on(InstantiateComponent|SetParent) with onBeforeMountComponent This lets us further consolidate hooks. The parent ID is now passed as an argument to onBeforeMountComponent() with the element. * Remove onMountRootComponent hook event It is unnecessary now that we pass the parent ID to onBeforeMountComponent. * Use parentDebugID = 0 both for roots and production This removes some awkward branching.

Dan Abramov committed Aug 11, 2016 at 19:35 UTC 0e976e136c0d0841aec71de4a4f6163963763d3f
15 files changed +84 -190
src/isomorphic/hooks/ReactComponentTreeHook.js
+17 -20
@@ -39,11 +39,11 @@ function remove(id) {
39 delete itemByKey[key];
40 }
41
42 -function create(id, element) {
42 +function create(id, element, parentID) {
43 var key = getKeyFromID(id);
44 itemByKey[key] = {
45 element,
46 - parentID: null,
46 + parentID,
47 text: null,
48 childIDs: [],
49 isMounted: false,
@@ -133,8 +133,8 @@ var ReactComponentTreeHook = {
133 }
134 invariant(
135 nextChild.parentID === id,
136 - 'Expected onSetParent() and onSetChildren() to be consistent (%s ' +
137 - 'has parents %s and %s).',
136 + 'Expected onBeforeMountComponent() parent and onSetChildren() to ' +
137 + 'be consistent (%s has parents %s and %s).',
138 nextChildID,
139 nextChild.parentID,
140 id
@@ -142,18 +142,12 @@ var ReactComponentTreeHook = {
142 }
143 },
144
145 - onSetParent(id, parentID) {
146 - var item = get(id);
147 - item.parentID = parentID;
148 - },
145 + onBeforeMountComponent(id, element, parentID) {
146 + create(id, element, parentID);
147
150 - onInstantiateComponent(id, element) {
151 - create(id, element);
152 - },
153 -
154 - onBeforeMountComponent(id, element) {
155 - var item = get(id);
156 - item.element = element;
148 + if (parentID === 0) {
149 + rootIDs[id] = true;
150 + }
151 },
152
153 onBeforeUpdateComponent(id, element) {
@@ -171,10 +165,6 @@ var ReactComponentTreeHook = {
165 item.isMounted = true;
166 },
167
174 - onMountRootComponent(id) {
175 - rootIDs[id] = true;
176 - },
177 -
168 onUpdateComponent(id) {
169 var item = get(id);
170 if (!item || !item.isMounted) {
@@ -187,7 +177,14 @@ var ReactComponentTreeHook = {
177
178 onUnmountComponent(id) {
179 var item = get(id);
190 - item.isMounted = false;
180 + if (item) {
181 + // We need to check if it exists.
182 + // `item` might not exist if it is inside an error boundary, and a sibling
183 + // error boundary child threw while mounting. Then this instance never
184 + // got a chance to mount, but it still gets an unmounting event during
185 + // the error boundary cleanup.
186 + item.isMounted = false;
187 + }
188 unmountedIDs[id] = true;
189 delete rootIDs[id];
190 },
src/renderers/dom/client/ReactMount.js
+2 -8
@@ -114,7 +114,8 @@ function mountComponentIntoNode(
114 transaction,
115 null,
116 ReactDOMContainerInfo(wrapperInstance, container),
117 - context
117 + context,
118 + 0 /* parentDebugID */
119 );
120
121 if (markerName) {
@@ -355,13 +356,6 @@ var ReactMount = {
356 var wrapperID = componentInstance._instance.rootID;
357 instancesByReactRootID[wrapperID] = componentInstance;
358
358 - if (__DEV__) {
359 - // The instance here is TopLevelWrapper so we report mount for its child.
360 - ReactInstrumentation.debugTool.onMountRootComponent(
361 - componentInstance._renderedComponent._debugID
362 - );
363 - }
364 -
359 return componentInstance;
360 },
361
src/renderers/dom/server/ReactServerRendering.js
+2 -1
@@ -47,7 +47,8 @@ function renderToStringImpl(element, makeStaticMarkup) {
47 transaction,
48 null,
49 ReactDOMContainerInfo(),
50 - emptyObject
50 + emptyObject,
51 + 0 /* parentDebugID */
52 );
53 if (__DEV__) {
54 ReactInstrumentation.debugTool.onUnmountComponent(
src/renderers/dom/shared/ReactDOMComponent.js
+1 -17
@@ -274,9 +274,7 @@ if (__DEV__) {
274 ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
275 ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
276 } else {
277 - ReactInstrumentation.debugTool.onInstantiateComponent(contentDebugID, content);
278 - ReactInstrumentation.debugTool.onSetParent(contentDebugID, debugID);
279 - ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content);
277 + ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
278 ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
279 ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
280 }
@@ -707,13 +705,6 @@ ReactDOMComponent.Mixin = {
705 break;
706 }
707
710 - if (__DEV__) {
711 - if (this._debugID) {
712 - var callback = () => ReactInstrumentation.debugTool.onComponentHasMounted(this._debugID);
713 - transaction.getReactMountReady().enqueue(callback, this);
714 - }
715 - }
716 -
708 return mountImage;
709 },
710
@@ -943,13 +934,6 @@ ReactDOMComponent.Mixin = {
934 transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
935 break;
936 }
946 -
947 - if (__DEV__) {
948 - if (this._debugID) {
949 - var callback = () => ReactInstrumentation.debugTool.onComponentHasUpdated(this._debugID);
950 - transaction.getReactMountReady().enqueue(callback, this);
951 - }
952 - }
937 },
938
939 /**
src/renderers/native/ReactNativeMount.js
+2 -7
@@ -56,7 +56,8 @@ function mountComponentIntoNode(
56 transaction,
57 null,
58 ReactNativeContainerInfo(containerTag),
59 - emptyObject
59 + emptyObject,
60 + 0 /* parentDebugID */
61 );
62 componentInstance._renderedComponent._topLevelWrapper = componentInstance;
63 ReactNativeMount._mountImageIntoNode(markup, containerTag);
@@ -147,12 +148,6 @@ var ReactNativeMount = {
148 instance,
149 containerTag
150 );
150 - if (__DEV__) {
151 - // The instance here is TopLevelWrapper so we report mount for its child.
152 - ReactInstrumentation.debugTool.onMountRootComponent(
153 - instance._renderedComponent._debugID
154 - );
155 - }
151 var component = instance.getPublicInstance();
152 if (callback) {
153 callback.call(component);
src/renderers/shared/ReactDebugTool.js
+11 -31
@@ -109,7 +109,10 @@ function resetMeasurements() {
109 currentFlushMeasurements = [];
110 }
111
112 -function checkDebugID(debugID) {
112 +function checkDebugID(debugID, allowRoot = false) {
113 + if (allowRoot && debugID === 0) {
114 + return;
115 + }
116 if (!debugID) {
117 warning(false, 'ReactDebugTool: debugID may not be empty.');
118 }
@@ -248,14 +251,6 @@ var ReactDebugTool = {
251 endLifeCycleTimer(debugID, timerType);
252 emitEvent('onEndLifeCycleTimer', debugID, timerType);
253 },
251 - onBeginReconcilerTimer(debugID, timerType) {
252 - checkDebugID(debugID);
253 - emitEvent('onBeginReconcilerTimer', debugID, timerType);
254 - },
255 - onEndReconcilerTimer(debugID, timerType) {
256 - checkDebugID(debugID);
257 - emitEvent('onEndReconcilerTimer', debugID, timerType);
258 - },
254 onError(debugID) {
255 if (currentTimerDebugID != null) {
256 endLifeCycleTimer(currentTimerDebugID, currentTimerType);
@@ -272,14 +267,6 @@ var ReactDebugTool = {
267 checkDebugID(debugID);
268 emitEvent('onHostOperation', debugID, type, payload);
269 },
275 - onComponentHasMounted(debugID) {
276 - checkDebugID(debugID);
277 - emitEvent('onComponentHasMounted', debugID);
278 - },
279 - onComponentHasUpdated(debugID) {
280 - checkDebugID(debugID);
281 - emitEvent('onComponentHasUpdated', debugID);
282 - },
270 onSetState() {
271 emitEvent('onSetState');
272 },
@@ -288,21 +275,10 @@ var ReactDebugTool = {
275 childDebugIDs.forEach(checkDebugID);
276 emitEvent('onSetChildren', debugID, childDebugIDs);
277 },
291 - onSetParent(debugID, parentDebugID) {
292 - checkDebugID(debugID);
293 - emitEvent('onSetParent', debugID, parentDebugID);
294 - },
295 - onInstantiateComponent(debugID, element) {
296 - checkDebugID(debugID);
297 - emitEvent('onInstantiateComponent', debugID, element);
298 - },
299 - onMountRootComponent(debugID) {
278 + onBeforeMountComponent(debugID, element, parentDebugID) {
279 checkDebugID(debugID);
301 - emitEvent('onMountRootComponent', debugID);
302 - },
303 - onBeforeMountComponent(debugID, element) {
304 - checkDebugID(debugID);
305 - emitEvent('onBeforeMountComponent', debugID, element);
280 + checkDebugID(parentDebugID, true);
281 + emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
282 },
283 onMountComponent(debugID) {
284 checkDebugID(debugID);
@@ -316,6 +292,10 @@ var ReactDebugTool = {
292 checkDebugID(debugID);
293 emitEvent('onUpdateComponent', debugID);
294 },
295 + onBeforeUnmountComponent(debugID) {
296 + checkDebugID(debugID);
297 + emitEvent('onBeforeUnmountComponent', debugID);
298 + },
299 onUnmountComponent(debugID) {
300 checkDebugID(debugID);
301 emitEvent('onUnmountComponent', debugID);
src/renderers/shared/hooks/ReactChildrenMutationWarningHook.js
+1 -1
@@ -50,7 +50,7 @@ var ReactChildrenMutationWarningHook = {
50 onMountComponent(debugID) {
51 handleElement(debugID, ReactComponentTreeHook.getElement(debugID));
52 },
53 - onComponentHasUpdated(debugID) {
53 + onUpdateComponent(debugID) {
54 handleElement(debugID, ReactComponentTreeHook.getElement(debugID));
55 },
56 };
src/renderers/shared/stack/reconciler/ReactChildReconciler.js
+6 -3
@@ -75,7 +75,7 @@ var ReactChildReconciler = {
75 nestedChildNodes,
76 transaction,
77 context,
78 - selfDebugID // __DEV__ only
78 + selfDebugID // 0 in production and for roots
79 ) {
80 if (nestedChildNodes == null) {
81 return null;
@@ -117,7 +117,9 @@ var ReactChildReconciler = {
117 transaction,
118 hostParent,
119 hostContainerInfo,
120 - context) {
120 + context,
121 + selfDebugID // 0 in production and for roots
122 + ) {
123 // We currently don't have a way to track moves here but if we use iterators
124 // instead of for..in we can zip the iterators and check if an item has
125 // moved.
@@ -156,7 +158,8 @@ var ReactChildReconciler = {
158 transaction,
159 hostParent,
160 hostContainerInfo,
159 - context
161 + context,
162 + selfDebugID
163 );
164 mountImages.push(nextChildMountImage);
165 }
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js
+10 -30
@@ -370,13 +370,6 @@ var ReactCompositeComponentMixin = {
370 }
371 }
372
373 - if (__DEV__) {
374 - if (this._debugID) {
375 - var callback = (component) => ReactInstrumentation.debugTool.onComponentHasMounted(this._debugID);
376 - transaction.getReactMountReady().enqueue(callback, this);
377 - }
378 - }
379 -
373 return markup;
374 },
375
@@ -532,21 +525,18 @@ var ReactCompositeComponentMixin = {
525 nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
526 );
527 this._renderedComponent = child;
528 +
529 + var selfDebugID = 0;
530 if (__DEV__) {
536 - if (child._debugID !== 0 && this._debugID !== 0) {
537 - ReactInstrumentation.debugTool.onSetParent(
538 - child._debugID,
539 - this._debugID
540 - );
541 - }
531 + selfDebugID = this._debugID;
532 }
543 -
533 var markup = ReactReconciler.mountComponent(
534 child,
535 transaction,
536 hostParent,
537 hostContainerInfo,
549 - this._processChildContext(context)
538 + this._processChildContext(context),
539 + selfDebugID
540 );
541
542 if (__DEV__) {
@@ -1024,13 +1014,6 @@ var ReactCompositeComponentMixin = {
1014 );
1015 }
1016 }
1027 -
1028 - if (__DEV__) {
1029 - if (this._debugID) {
1030 - var callback = () => ReactInstrumentation.debugTool.onComponentHasUpdated(this._debugID);
1031 - transaction.getReactMountReady().enqueue(callback, this);
1032 - }
1033 - }
1017 },
1018
1019 /**
@@ -1061,21 +1044,18 @@ var ReactCompositeComponentMixin = {
1044 nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
1045 );
1046 this._renderedComponent = child;
1047 +
1048 + var selfDebugID = 0;
1049 if (__DEV__) {
1065 - if (child._debugID !== 0 && this._debugID !== 0) {
1066 - ReactInstrumentation.debugTool.onSetParent(
1067 - child._debugID,
1068 - this._debugID
1069 - );
1070 - }
1050 + selfDebugID = this._debugID;
1051 }
1072 -
1052 var nextMarkup = ReactReconciler.mountComponent(
1053 child,
1054 transaction,
1055 this._hostParent,
1056 this._hostContainerInfo,
1078 - this._processChildContext(context)
1057 + this._processChildContext(context),
1058 + selfDebugID
1059 );
1060
1061 if (__DEV__) {
src/renderers/shared/stack/reconciler/ReactMultiChild.js
+14 -16
@@ -140,7 +140,6 @@ function processQueue(inst, updateQueue) {
140 );
141 }
142
143 -var setParentForInstrumentation = emptyFunction;
143 var setChildrenForInstrumentation = emptyFunction;
144 if (__DEV__) {
145 var getDebugID = function(inst) {
@@ -153,14 +152,6 @@ if (__DEV__) {
152 }
153 return inst._debugID;
154 };
156 - setParentForInstrumentation = function(child) {
157 - if (child._debugID !== 0) {
158 - ReactInstrumentation.debugTool.onSetParent(
159 - child._debugID,
160 - getDebugID(this)
161 - );
162 - }
163 - };
155 setChildrenForInstrumentation = function(children) {
156 var debugID = getDebugID(this);
157 // TODO: React Native empty components are also multichild.
@@ -193,11 +184,12 @@ var ReactMultiChild = {
184
185 _reconcilerInstantiateChildren: function(nestedChildren, transaction, context) {
186 if (__DEV__) {
187 + var selfDebugID = getDebugID(this);
188 if (this._currentElement) {
189 try {
190 ReactCurrentOwner.current = this._currentElement._owner;
191 return ReactChildReconciler.instantiateChildren(
200 - nestedChildren, transaction, context, this._debugID
192 + nestedChildren, transaction, context, selfDebugID
193 );
194 } finally {
195 ReactCurrentOwner.current = null;
@@ -218,11 +210,13 @@ var ReactMultiChild = {
210 context
211 ) {
212 var nextChildren;
213 + var selfDebugID = 0;
214 if (__DEV__) {
215 + selfDebugID = getDebugID(this);
216 if (this._currentElement) {
217 try {
218 ReactCurrentOwner.current = this._currentElement._owner;
225 - nextChildren = flattenChildren(nextNestedChildrenElements, this._debugID);
219 + nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
220 } finally {
221 ReactCurrentOwner.current = null;
222 }
@@ -234,12 +228,13 @@ var ReactMultiChild = {
228 transaction,
229 this,
230 this._hostContainerInfo,
237 - context
231 + context,
232 + selfDebugID
233 );
234 return nextChildren;
235 }
236 }
242 - nextChildren = flattenChildren(nextNestedChildrenElements);
237 + nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
238 ReactChildReconciler.updateChildren(
239 prevChildren,
240 nextChildren,
@@ -248,7 +243,8 @@ var ReactMultiChild = {
243 transaction,
244 this,
245 this._hostContainerInfo,
251 - context
246 + context,
247 + selfDebugID
248 );
249 return nextChildren;
250 },
@@ -272,15 +268,17 @@ var ReactMultiChild = {
268 for (var name in children) {
269 if (children.hasOwnProperty(name)) {
270 var child = children[name];
271 + var selfDebugID = 0;
272 if (__DEV__) {
276 - setParentForInstrumentation.call(this, child);
273 + selfDebugID = getDebugID(this);
274 }
275 var mountImage = ReactReconciler.mountComponent(
276 child,
277 transaction,
278 this,
279 this._hostContainerInfo,
283 - context
280 + context,
281 + selfDebugID
282 );
283 child._mountIndex = index++;
284 mountImages.push(mountImage);
src/renderers/shared/stack/reconciler/ReactReconciler.js
+8 -34
@@ -42,17 +42,15 @@ var ReactReconciler = {
42 transaction,
43 hostParent,
44 hostContainerInfo,
45 - context
45 + context,
46 + parentDebugID // 0 in production and for roots
47 ) {
48 if (__DEV__) {
49 if (internalInstance._debugID !== 0) {
50 ReactInstrumentation.debugTool.onBeforeMountComponent(
51 internalInstance._debugID,
51 - internalInstance._currentElement
52 - );
53 - ReactInstrumentation.debugTool.onBeginReconcilerTimer(
54 - internalInstance._debugID,
55 - 'mountComponent'
52 + internalInstance._currentElement,
53 + parentDebugID
54 );
55 }
56 }
@@ -60,7 +58,8 @@ var ReactReconciler = {
58 transaction,
59 hostParent,
60 hostContainerInfo,
63 - context
61 + context,
62 + parentDebugID
63 );
64 if (internalInstance._currentElement &&
65 internalInstance._currentElement.ref != null) {
@@ -68,10 +67,6 @@ var ReactReconciler = {
67 }
68 if (__DEV__) {
69 if (internalInstance._debugID !== 0) {
71 - ReactInstrumentation.debugTool.onEndReconcilerTimer(
72 - internalInstance._debugID,
73 - 'mountComponent'
74 - );
70 ReactInstrumentation.debugTool.onMountComponent(
71 internalInstance._debugID
72 );
@@ -97,9 +92,8 @@ var ReactReconciler = {
92 unmountComponent: function(internalInstance, safely) {
93 if (__DEV__) {
94 if (internalInstance._debugID !== 0) {
100 - ReactInstrumentation.debugTool.onBeginReconcilerTimer(
101 - internalInstance._debugID,
102 - 'unmountComponent'
95 + ReactInstrumentation.debugTool.onBeforeUnmountComponent(
96 + internalInstance._debugID
97 );
98 }
99 }
@@ -107,10 +101,6 @@ var ReactReconciler = {
101 internalInstance.unmountComponent(safely);
102 if (__DEV__) {
103 if (internalInstance._debugID !== 0) {
110 - ReactInstrumentation.debugTool.onEndReconcilerTimer(
111 - internalInstance._debugID,
112 - 'unmountComponent'
113 - );
104 ReactInstrumentation.debugTool.onUnmountComponent(
105 internalInstance._debugID
106 );
@@ -154,10 +144,6 @@ var ReactReconciler = {
144 internalInstance._debugID,
145 nextElement
146 );
157 - ReactInstrumentation.debugTool.onBeginReconcilerTimer(
158 - internalInstance._debugID,
159 - 'receiveComponent'
160 - );
147 }
148 }
149
@@ -180,10 +166,6 @@ var ReactReconciler = {
166
167 if (__DEV__) {
168 if (internalInstance._debugID !== 0) {
183 - ReactInstrumentation.debugTool.onEndReconcilerTimer(
184 - internalInstance._debugID,
185 - 'receiveComponent'
186 - );
169 ReactInstrumentation.debugTool.onUpdateComponent(
170 internalInstance._debugID
171 );
@@ -218,10 +200,6 @@ var ReactReconciler = {
200 }
201 if (__DEV__) {
202 if (internalInstance._debugID !== 0) {
221 - ReactInstrumentation.debugTool.onBeginReconcilerTimer(
222 - internalInstance._debugID,
223 - 'performUpdateIfNecessary'
224 - );
203 ReactInstrumentation.debugTool.onBeforeUpdateComponent(
204 internalInstance._debugID,
205 internalInstance._currentElement
@@ -231,10 +209,6 @@ var ReactReconciler = {
209 internalInstance.performUpdateIfNecessary(transaction);
210 if (__DEV__) {
211 if (internalInstance._debugID !== 0) {
234 - ReactInstrumentation.debugTool.onEndReconcilerTimer(
235 - internalInstance._debugID,
236 - 'performUpdateIfNecessary'
237 - );
212 ReactInstrumentation.debugTool.onUpdateComponent(
213 internalInstance._debugID
214 );
src/renderers/shared/stack/reconciler/ReactSimpleEmptyComponent.js
+4 -2
@@ -23,14 +23,16 @@ Object.assign(ReactSimpleEmptyComponent.prototype, {
23 transaction,
24 hostParent,
25 hostContainerInfo,
26 - context
26 + context,
27 + parentDebugID // 0 in production and for roots
28 ) {
29 return ReactReconciler.mountComponent(
30 this._renderedComponent,
31 transaction,
32 hostParent,
33 hostContainerInfo,
33 - context
34 + context,
35 + parentDebugID
36 );
37 },
38 receiveComponent: function() {
src/renderers/shared/stack/reconciler/instantiateReactComponent.js
+1 -8
@@ -14,7 +14,6 @@
14 var ReactCompositeComponent = require('ReactCompositeComponent');
15 var ReactEmptyComponent = require('ReactEmptyComponent');
16 var ReactHostComponent = require('ReactHostComponent');
17 -var ReactInstrumentation = require('ReactInstrumentation');
17
18 var invariant = require('invariant');
19 var warning = require('warning');
@@ -126,13 +125,7 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
125 instance._mountImage = null;
126
127 if (__DEV__) {
129 - if (shouldHaveDebugID) {
130 - var debugID = nextDebugID++;
131 - instance._debugID = debugID;
132 - ReactInstrumentation.debugTool.onInstantiateComponent(debugID, node);
133 - } else {
134 - instance._debugID = 0;
135 - }
128 + instance._debugID = shouldHaveDebugID ? nextDebugID++ : 0;
129 }
130
131 // Internal instances should fully constructed at this point, so they should
src/renderers/testing/ReactTestMount.js
-7
@@ -12,7 +12,6 @@
12 'use strict';
13
14 var ReactElement = require('ReactElement');
15 -var ReactInstrumentation = require('ReactInstrumentation');
15 var ReactReconciler = require('ReactReconciler');
16 var ReactUpdates = require('ReactUpdates');
17
@@ -160,12 +159,6 @@ var ReactTestMount = {
159 batchedMountComponentIntoNode,
160 instance
161 );
163 - if (__DEV__) {
164 - // The instance here is TopLevelWrapper so we report mount for its child.
165 - ReactInstrumentation.debugTool.onMountRootComponent(
166 - instance._renderedComponent._debugID
167 - );
168 - }
162 return new ReactTestInstance(instance);
163 },
164
src/test/ReactTestUtils.js
+5 -5
@@ -23,7 +23,6 @@ var ReactElement = require('ReactElement');
23 var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
24 var ReactCompositeComponent = require('ReactCompositeComponent');
25 var ReactInstanceMap = require('ReactInstanceMap');
26 -var ReactInstrumentation = require('ReactInstrumentation');
26 var ReactReconciler = require('ReactReconciler');
27 var ReactUpdates = require('ReactUpdates');
28 var SyntheticEvent = require('SyntheticEvent');
@@ -383,8 +382,10 @@ var nextDebugID = 1;
382 var NoopInternalComponent = function(element) {
383 this._renderedOutput = element;
384 this._currentElement = element;
386 - this._debugID = nextDebugID++;
387 - ReactInstrumentation.debugTool.onInstantiateComponent(this._debugID, element);
385 +
386 + if (__DEV__) {
387 + this._debugID = nextDebugID++;
388 + }
389 };
390
391 NoopInternalComponent.prototype = {
@@ -413,7 +414,6 @@ var ShallowComponentWrapper = function(element) {
414 // TODO: Consolidate with instantiateReactComponent
415 if (__DEV__) {
416 this._debugID = nextDebugID++;
416 - ReactInstrumentation.debugTool.onInstantiateComponent(this._debugID, element);
417 }
418
419 this.construct(element);
@@ -493,7 +493,7 @@ ReactShallowRenderer.prototype._render = function(element, transaction, context)
493 );
494 } else {
495 var instance = new ShallowComponentWrapper(element);
496 - ReactReconciler.mountComponent(instance, transaction, null, null, context);
496 + ReactReconciler.mountComponent(instance, transaction, null, null, context, 0);
497 this._instance = instance;
498 }
499 };