How do you make a LazyColumn reset scroll to zero ...
# compose
r
How do you make a LazyColumn reset scroll to zero when a model changes? Code in thread is not working.
Copy code
// Taken from rememberLazyListState()
val lazyListState = rememberSaveable(searchModel.query, saver = LazyListState.Saver) {
        Log.i(TAG, "New lazyListState")
        LazyListState()
    }
…
LazyColumn(state = lazyListState) {
When the the
query
changes I'd like it to be back at scroll position zero. Instead the column is showing new data, but scrolled into it already.
n
I would do : LaunchedEffect(query) { lazyListState.scrollTo(0) }
r
Okay. I used
scrollToItem(0)
since that's all I see. My problem is now it scrolls to zero when I leave and come back to screen, even when
query
doesn't change.