I am trying to use compose Paging with `collectAsL...
# compose
k
I am trying to use compose Paging with
collectAsLazyPagingItems
. Everything works fine until I scroll to a position which is bigger than the pagingSize and then I call
invalidate()
to get the pager data to reload. After this the
lazyItems
first only reloads the data for the visible viewport. My problem is that the
rememberLazyListState()
is not calculating the right position in this case and the scroll position is wrong. When I delete an item from the first half of the list that is < pagingSize then everything works fine. Is there something like:
rememberPagingLazyListState()
or am I making a mistake and it is supposed to work with
rememberLazyListState()
?
I found that I was using the wrong
items()
, I needed to use
LazyListScope.items()
and I needed to provide the parameter key, I added
item.id
to be able to identify my items. After this the scrolling is working at expected.