Skip to content

Commit

Permalink
Ensures that the lifecycle listener release is the last to be invoked
Browse files Browse the repository at this point in the history
Summary: Ensures that the lifecycle listener release is the last to be invoked

Differential Revision: D55653563

fbshipit-source-id: ad27cfd4fa5727395dc62f29a51ae12ec53e96d3
  • Loading branch information
adityasharat authored and facebook-github-bot committed Apr 2, 2024
1 parent 2b6ca16 commit 140784e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ fun NestedLithoPrimitive(
contentAllocator = ViewAllocator { LithoRenderTreeView(it) },
) {

// the litho lifecycle listener release callback should be the last binder to be unbound
withDescription("lifecycle-provider-release") {
bind(nestedTreeId.id) { _ -> onUnbind { lifecycleProvider.release() } }
}

// binder to clean up the content before returning it to the pool
withDescription("final-unmount") {
bind(nestedTreeId.id) { content ->
Expand All @@ -125,10 +130,6 @@ fun NestedLithoPrimitive(
}
}

withDescription("lifecycle-provider-release") {
bind(nestedTreeId.id) { _ -> onUnbind { lifecycleProvider.release() } }
}

// binder to bind the layout state with the Litho Render Tree View
withDescription("litho-tree") {
bindWithLayoutData<LayoutState> { content, layoutState ->
Expand Down

0 comments on commit 140784e

Please sign in to comment.