title: Jetpack Compose - Restore LazyColumn Scroll State
body: <p>I have a <code>LazyColumn</code> that contains multiple <code>LazyRow</code>. In old terms, nested RecyclerView.</p>
  <p>My problem is, <code>LazyColumn</code> does not restore scroll state when move to a new composable (Different tab). But inner <code>LazyRow</code>s restore their states.</p>
  <p>For example, open home screen, scroll to bottom then scroll <code>LazyRow</code> to end then open a different tab and back to home tab again. <code>LazyColumn</code> starts from top (does not restore state) but the last <code>LazyRow</code> restore it's scroll state.</p>
  <p>HomeScreen that contains <code>LazyColumn</code></p>
  <pre><code>@Composable
  fun HomeScreen(
      homeViewModel: HomeViewModel = hiltViewModel()
  ) {
  
      val scrollState = rememberLazyListState()
  
      LazyColumn(contentPadding = PaddingValues(vertical = 8.dp),
          horizontalAlignment = Alignment.Start,
          verticalArrangement = Arrangement.spacedBy(8.dp),
          state = scrollState,
          modifier = Modifier
              .fillMaxSize()
              .background(MaterialTheme.colors.background)
      ) {
          items(5) {
              TopRatedProducts(homeViewModel = homeViewModel)
          }
      }
  }
  </code></pre>
  <p>TopRatedProducts that contains <code>LazyRow</code></p>
  <pre><code>@Composable
  fun TopRatedProducts(
      homeViewModel: HomeViewModel = hiltViewModel()
  ) {
      val topRatedProducts by rememberFlowWithLifecycle(homeViewModel.topRatedProducts)
          .collectAsState(initial = emptyList())
  
      LazyRow(
          contentPadding = PaddingValues(horizontal = 8.dp), // Space between start and end
          verticalAlignment = Alignment.CenterVertically,
          horizontalArrangement = Arrangement.spacedBy(8.dp), // Space between items
          modifier = Modifier
              .background(Color.Green)
      ) {
          items(topRatedProducts) {
              ProductCardItem(item = it)
          }
      }
  }
  </code></pre>
  <p>How can I restore <code>LazyColumn</code> scroll state?</p>