What would be to best way to reset the scroll of a lazylist in Compose when the list is updated from...
l
What would be to best way to reset the scroll of a lazylist in Compose when the list is updated from the viewModel ?
I would go with this (and it's working fine):
Copy code
LaunchedEffect(myList) {
   myScrollState.scrollToItem(0)
}
But I'm not sure this is the best option 🤔
a
you can also do it like this:
Copy code
val state = key(myList) { rememberLazyListState() }
LazyColumn(state = state) {  }
👍 1
l
Oh thanks, this is a very nice way to do it 👍