myanmarking
03/11/2022, 3:35 PMval onItemClicked = { index: Int ->
listInfoState.animateScrollToItem(index)
}
Why would this cause the excess recomposition i am having, without evening triggering the click ?myanmarking
03/11/2022, 3:37 PMval onItemClicked = rememberUpdatedState(
newValue = { index: Int ->
listInfoState.animateScrollToItem(index)
}
)
solves the issue. i don’t understand whymkrussel
03/11/2022, 3:49 PMonItemClicked
will not be equal to the previous lambda that was created it triggers recomposition.
A cleaner option then using remembeUpdatedState
could be to use method references listInfoState::animateScrollToItem
myanmarking
03/11/2022, 3:50 PMmkrussel
03/11/2022, 3:50 PMmyanmarking
03/11/2022, 3:51 PMtheapache64
03/13/2022, 10:10 AMmkrussel
03/13/2022, 6:22 PMmyanmarking
03/13/2022, 6:35 PMmyanmarking
03/13/2022, 6:36 PMrecomposeHighlighter
extension property suggested by google play teammyanmarking
03/13/2022, 6:37 PM