Skip to content

Commit

Permalink
make RenderResult constructor public
Browse files Browse the repository at this point in the history
Summary:
In Signals, we want to be able to reuse `RenderTree`s across generations if the associated layout result and layout signal hasn't changed. This is particularly of use in determining whether to invalidate a collection's cells as will be seen in upcoming diffs

However, none of `RenderResult`s static creator functions allow this because the decision to reuse a previous `RenderTree` is based off of node/model pointer equality which no longer really works in Signals

Hence, we're opening up the constructor of `RenderResult` to allow callers to instantiate a `RenderResult` with a `RenderTree` of their choice.

Reviewed By: pasqualeanatriello

Differential Revision: D68839596

fbshipit-source-id: 52bf736ad135f20c2647b0efa3a2f0f24f6de1c2
  • Loading branch information
Daniel Famakin authored and facebook-github-bot committed Jan 31, 2025
1 parent e8e2ba1 commit 2a15bc9
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import com.facebook.rendercore.extensions.RenderCoreExtension
* computation will make the next computation of a new [RenderResult] more efficient with internal
* caching.
*/
class RenderResult<State, RenderContext>
internal constructor(
class RenderResult<State, RenderContext>(
val renderTree: RenderTree,
val nodeTree: Node<RenderContext>,
val layoutCacheData: Map<Any, Any?>,
Expand Down

0 comments on commit 2a15bc9

Please sign in to comment.