Hello! What's the best behaviour to reset the scro...
# compose
l
Hello! What's the best behaviour to reset the scroll of LazyColumn/LazyRow after an UI update without being impacted by navigation? Using the following:
Copy code
LaunchedEffect(dataList) {
    lazyListState.scrollToItem(0)
}
Because the coroutine will be cancelled when the LaunchedEffect leaves the composition, this will be triggered if I navigate back to the view. Thanks!
solved 1
a
You can use
val lazyListState = key(dataList) { rememberLazyListState() }
.
l
Thanks, it works like a charm!