@@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.height
1212import androidx.compose.foundation.layout.padding
1313import androidx.compose.foundation.layout.width
1414import androidx.compose.foundation.lazy.LazyColumn
15+ import androidx.compose.foundation.lazy.rememberLazyListState
1516import androidx.compose.foundation.shape.RoundedCornerShape
1617import androidx.compose.material.icons.Icons
1718import androidx.compose.material.icons.automirrored.filled.ArrowBack
@@ -31,6 +32,7 @@ import androidx.compose.runtime.Composable
3132import androidx.compose.runtime.CompositionLocalProvider
3233import androidx.compose.runtime.collectAsState
3334import androidx.compose.runtime.getValue
35+ import androidx.compose.runtime.key
3436import androidx.compose.runtime.remember
3537import androidx.compose.runtime.rememberCoroutineScope
3638import androidx.compose.ui.Modifier
@@ -90,6 +92,7 @@ fun ActionLogPage(
9092 val navController = LocalNavController .current
9193 val vm = viewModel<ActionLogVm >()
9294 val actionDataItems = vm.pagingDataFlow.collectAsLazyPagingItems()
95+ val listState = key(actionDataItems.itemCount > 0 ) { rememberLazyListState() }
9396
9497 val timeTextWidth = measureNumberTextWidth(MaterialTheme .typography.bodySmall)
9598
@@ -158,6 +161,7 @@ fun ActionLogPage(
158161 }, content = { contentPadding ->
159162 LazyColumn (
160163 modifier = Modifier .scaffoldPadding(contentPadding),
164+ state = listState,
161165 ) {
162166 items(
163167 count = actionDataItems.itemCount,
0 commit comments