From d5467b315d1f3482582fcfd8bbc995911f1ed64e Mon Sep 17 00:00:00 2001 From: tornaco Date: Sat, 18 Jun 2022 09:39:29 +0800 Subject: [PATCH] [app] set header compose ViewCompositionStrategy to DisposeOnViewTreeLifecycleDestroyed --- .../android/thanos/dashboard/DashboardCardAdapterKt.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/app/src/main/java/github/tornaco/android/thanos/dashboard/DashboardCardAdapterKt.kt b/android/app/src/main/java/github/tornaco/android/thanos/dashboard/DashboardCardAdapterKt.kt index fc7ed4e8c..2b8161eac 100644 --- a/android/app/src/main/java/github/tornaco/android/thanos/dashboard/DashboardCardAdapterKt.kt +++ b/android/app/src/main/java/github/tornaco/android/thanos/dashboard/DashboardCardAdapterKt.kt @@ -23,6 +23,7 @@ import android.view.View import android.view.ViewGroup import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.recyclerview.widget.RecyclerView import com.elvishew.xlog.XLog import github.tornaco.android.thanos.databinding.ItemFeatureDashboardFooterBinding @@ -124,6 +125,11 @@ internal class HeaderHolder( init { XLog.d("init: HeaderHolder-${hashCode()}") + + binding.compose.setViewCompositionStrategy( + ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed + ) + binding.compose.setContent { val state by _state.collectAsState() HeaderContent(state, onHeaderClick)