Skip to content

Commit

Permalink
Add event for RenderUnit.Updated
Browse files Browse the repository at this point in the history
Summary: Adds an event for `RenderUnit.Updated`. I will use this for tooling in IG>

Reviewed By: adityasharat

Differential Revision: D45228498

fbshipit-source-id: 13e524bca24f0b9a9e38015d749013b4b87d552e
  • Loading branch information
Fabio Carballo authored and facebook-github-bot committed Apr 24, 2023
1 parent 2b70179 commit c6e8566
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ private void unmountItemRecursively(final long id) {
attributes -> {
attributes.put(RenderUnitId, id);
attributes.put(Description, unit.getDescription());
attributes.put(Bounds, node.getBounds());
attributes.put(RootHostHashCode, mRootHost.hashCode());
},
scope -> {
if (isTracing) {
Expand Down Expand Up @@ -1084,14 +1086,27 @@ private void updateMountItemIfNeeded(RenderTreeNode renderTreeNode, MountItem cu
mTracer.beginSection("UpdateItem: " + renderUnit.getDescription());
}

renderUnit.updateBinders(
mContext,
content,
currentRenderUnit,
currentLayoutData,
newLayoutData,
mountDelegate,
currentMountItem.isBound());
trace(
DebugEvent.RenderUnitUpdated,
String.valueOf(mRenderTree.getRenderStateId()),
attributes -> {
attributes.put(RenderUnitId, renderTreeNode.getRenderUnit().getId());
attributes.put(Description, renderTreeNode.getRenderUnit().getDescription());
attributes.put(Bounds, renderTreeNode.getBounds());
attributes.put(RootHostHashCode, mRootHost.hashCode());
},
scope -> {
renderUnit.updateBinders(
mContext,
content,
currentRenderUnit,
currentLayoutData,
newLayoutData,
mountDelegate,
currentMountItem.isBound());

return Unit.INSTANCE;
});
}

currentMountItem.setIsBound(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ sealed class DebugEvent(
const val MountItemMount = "RenderCore.MountItem.Mount"
const val RenderUnitMounted = "RenderCore.RenderUnit.Mounted"
const val RenderUnitUnmounted = "RenderCore.RenderUnit.Unmounted"
const val RenderUnitUpdated = "RenderCore.RenderUnit.Updated"
}

/** Returns the value of attribute with [name]. */
Expand Down

0 comments on commit c6e8566

Please sign in to comment.