From 7238bda5644a004aa6f86ac1f581c34ed2938d32 Mon Sep 17 00:00:00 2001 From: Aditya Sharat Date: Wed, 20 Sep 2023 06:39:14 -0700 Subject: [PATCH] Do not rebind if setting the same component tree Summary: Do not rebind if setting the same component tree Reviewed By: zielinskimz Differential Revision: D49053899 fbshipit-source-id: f119f0b2dad7cd730112c05b4719457d7d229fa3 --- litho-core/src/main/java/com/facebook/litho/LithoView.java | 2 +- .../java/com/facebook/litho/config/ComponentsConfiguration.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/litho-core/src/main/java/com/facebook/litho/LithoView.java b/litho-core/src/main/java/com/facebook/litho/LithoView.java index e31237b58b1..fbfaf545dcd 100644 --- a/litho-core/src/main/java/com/facebook/litho/LithoView.java +++ b/litho-core/src/main/java/com/facebook/litho/LithoView.java @@ -416,7 +416,7 @@ public void setComponentTree( mTemporaryDetachedComponentTree = null; if (mComponentTree == componentTree) { - if (isAttached()) { + if (ComponentsConfiguration.bindOnSameComponentTree && isAttached()) { rebind(); } return; diff --git a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java index 272ed9ae8fe..2ffdb18dc11 100644 --- a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java +++ b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java @@ -256,6 +256,8 @@ public static boolean shouldUseLruCacheForUseCached() { private static boolean sReduceMemorySpikeDataDiffSection = false; private static boolean sReduceMemorySpikeGetUri = false; + public static boolean bindOnSameComponentTree = true; + public static void setReduceMemorySpikeUserSession() { sReduceMemorySpikeUserSession = true; }