Skip to content

Commit

Permalink
[app] set header compose ViewCompositionStrategy to DisposeOnViewTree…
Browse files Browse the repository at this point in the history
…LifecycleDestroyed
  • Loading branch information
Tornaco committed Jun 18, 2022
1 parent 49598ba commit d5467b3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d5467b3

Please sign in to comment.