Hi all. I have a LazyColumn where I load data with...
# compose-android
r
Hi all. I have a LazyColumn where I load data with PagingLibrary 3. Each element of the list has bookmark/unbookmark toggle. After each toggle action I refresh the LazyPagingItems to update the correct state of the toggle. (Same for item delete). Sometimes after refresh the list is being scrolled either up or down randomly. Did anyone faced such issues?
🚫 3
s
What do the data source and remote mediator look like for your Paging3 implementation? Are you loading from a Room data source, or somewhere else?
r
There's no remote mediator, I directly load from my backend
a
Do you set the
key
-parameter for the
LazyColumn
to determine the id uniquely related to each of your backend-items?
r
yes
a
Do you reorder the items based on their state-change?
I had a similar problem, where I have basically items in a LazyRow with Move-Left- and Move-Right-buttons, and after using these buttons, the LazyRow-scroller tries to stay wih the moved item instead of staying at the same scrollposition. I went to use the workaorund described in https://medium.com/@gregkorossy/hacking-lazylist-in-android-jetpack-compose-38afacb3df67