diff --git a/litho-core/src/main/java/com/facebook/litho/ComponentTree.java b/litho-core/src/main/java/com/facebook/litho/ComponentTree.java index a0f4cd9928..c882c5dc45 100644 --- a/litho-core/src/main/java/com/facebook/litho/ComponentTree.java +++ b/litho-core/src/main/java/com/facebook/litho/ComponentTree.java @@ -375,11 +375,9 @@ protected ComponentTree(Builder builder) { if (ComponentsConfiguration.defaultInstance.enableLifecycleOwnerWrapper) { LifecycleOwner implicitLifecycleOwner = getImplicitLifecycleOwner(builder.treePropContainer); mImplicitTreePropContainer = createImplicitTreePropContainer(implicitLifecycleOwner); - } - - @Nullable final PoolScope poolScope = builder.mPoolScope; - if (poolScope != null) { - mImplicitTreePropContainer.put(PoolScopeTreeProp, poolScope); + if (ComponentsConfiguration.customPoolScopesEnabled) { + mImplicitTreePropContainer.put(PoolScopeTreeProp, builder.mPoolScope); + } } if (useComponentTreePropContainerAsSourceOfTruth) { diff --git a/litho-rendercore/src/main/java/com/facebook/rendercore/MountItemsPool.kt b/litho-rendercore/src/main/java/com/facebook/rendercore/MountItemsPool.kt index 0b79d66d53..69a62bb862 100644 --- a/litho-rendercore/src/main/java/com/facebook/rendercore/MountItemsPool.kt +++ b/litho-rendercore/src/main/java/com/facebook/rendercore/MountItemsPool.kt @@ -581,7 +581,7 @@ sealed interface PoolScope { * A pool scope that automatically releases the pool when the given [lifecycle] transitions to * destroyed state */ - class LifecycleAware(private val lifecycle: Lifecycle) : PoolScope { + class LifecycleAware(lifecycle: Lifecycle) : PoolScope { init { lifecycle.addObserver( object : DefaultLifecycleObserver { diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java index 2fa3ab174d..fb138cb82a 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java @@ -69,6 +69,7 @@ import com.facebook.litho.Size; import com.facebook.litho.SizeSpec; import com.facebook.litho.ThreadUtils; +import com.facebook.litho.annotations.ExperimentalLithoApi; import com.facebook.litho.choreographercompat.ChoreographerCompat; import com.facebook.litho.choreographercompat.ChoreographerCompatImpl; import com.facebook.litho.config.ComponentsConfiguration; @@ -602,6 +603,7 @@ public Builder errorHandler(@Nullable Function1 handler) { return this; } + @ExperimentalLithoApi public Builder poolScope(PoolScope poolScope) { this.poolScope = poolScope; return this;