Optimize the update of state during first render of a View

Summary: This is an optimization to avoid transfering updateState instructions twice during the frist render of a view (same a props)

Reviewed By: shergin

Differential Revision: D15476041

fbshipit-source-id: 8a62035dbbb63c93f86a2f8d217986a325cb1805
This commit is contained in:
David Vacca
2019-05-24 11:30:30 -07:00
committed by Facebook Github Bot
parent cd5fe06abe
commit 92f8fd22e2
@@ -458,6 +458,12 @@ void Binding::schedulerDidFinishTransaction(
deletedViewTags.end()) {
mountItems[position++] =
createUpdatePropsMountItem(javaUIManager_, mutation);
// State
if (mutation.newChildShadowView.state) {
mountItems[position++] =
createUpdateStateMountItem(javaUIManager_, mutation);
}
}
// LocalData
@@ -472,12 +478,6 @@ void Binding::schedulerDidFinishTransaction(
if (updateLayoutMountItem) {
mountItems[position++] = updateLayoutMountItem;
}
// State
if (mutation.newChildShadowView.state) {
mountItems[position++] =
createUpdateStateMountItem(javaUIManager_, mutation);
}
}
// EventEmitter