-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate hook events #7472
Consolidate hook events #7472
Changes from 1 commit
9db9a34
1ae6186
cf702b1
bf58f38
1d841a1
315471e
0b68348
ac7aa31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,6 @@ function processQueue(inst, updateQueue) { | |
); | ||
} | ||
|
||
var setParentForInstrumentation = emptyFunction; | ||
var setChildrenForInstrumentation = emptyFunction; | ||
if (__DEV__) { | ||
var getDebugID = function(inst) { | ||
|
@@ -153,14 +152,6 @@ if (__DEV__) { | |
} | ||
return inst._debugID; | ||
}; | ||
setParentForInstrumentation = function(child) { | ||
if (child._debugID !== 0) { | ||
ReactInstrumentation.debugTool.onSetParent( | ||
child._debugID, | ||
getDebugID(this) | ||
); | ||
} | ||
}; | ||
setChildrenForInstrumentation = function(children) { | ||
var debugID = getDebugID(this); | ||
// TODO: React Native empty components are also multichild. | ||
|
@@ -193,11 +184,12 @@ var ReactMultiChild = { | |
|
||
_reconcilerInstantiateChildren: function(nestedChildren, transaction, context) { | ||
if (__DEV__) { | ||
var selfDebugID = getDebugID(this); | ||
if (this._currentElement) { | ||
try { | ||
ReactCurrentOwner.current = this._currentElement._owner; | ||
return ReactChildReconciler.instantiateChildren( | ||
nestedChildren, transaction, context, this._debugID | ||
nestedChildren, transaction, context, selfDebugID | ||
); | ||
} finally { | ||
ReactCurrentOwner.current = null; | ||
|
@@ -218,11 +210,14 @@ var ReactMultiChild = { | |
context | ||
) { | ||
var nextChildren; | ||
var selfDebugID; | ||
|
||
if (__DEV__) { | ||
selfDebugID = getDebugID(this); | ||
if (this._currentElement) { | ||
try { | ||
ReactCurrentOwner.current = this._currentElement._owner; | ||
nextChildren = flattenChildren(nextNestedChildrenElements, this._debugID); | ||
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
} finally { | ||
ReactCurrentOwner.current = null; | ||
} | ||
|
@@ -234,12 +229,13 @@ var ReactMultiChild = { | |
transaction, | ||
this, | ||
this._hostContainerInfo, | ||
context | ||
context, | ||
selfDebugID | ||
); | ||
return nextChildren; | ||
} | ||
} | ||
nextChildren = flattenChildren(nextNestedChildrenElements); | ||
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting that we weren’t passing it before (this code path could still run in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, when is this._currentElement not set? Not even sure why we have that check. |
||
ReactChildReconciler.updateChildren( | ||
prevChildren, | ||
nextChildren, | ||
|
@@ -248,7 +244,8 @@ var ReactMultiChild = { | |
transaction, | ||
this, | ||
this._hostContainerInfo, | ||
context | ||
context, | ||
selfDebugID | ||
); | ||
return nextChildren; | ||
}, | ||
|
@@ -272,15 +269,17 @@ var ReactMultiChild = { | |
for (var name in children) { | ||
if (children.hasOwnProperty(name)) { | ||
var child = children[name]; | ||
var selfDebugID; | ||
if (__DEV__) { | ||
setParentForInstrumentation.call(this, child); | ||
selfDebugID = getDebugID(this); | ||
} | ||
var mountImage = ReactReconciler.mountComponent( | ||
child, | ||
transaction, | ||
this, | ||
this._hostContainerInfo, | ||
context | ||
context, | ||
selfDebugID | ||
); | ||
child._mountIndex = index++; | ||
mountImages.push(mountImage); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop these
__DEV__
blocks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea.