Hi, How can I remember my `LazyColumn` scroll posi...
# compose
c
Hi, How can I remember my
LazyColumn
scroll position aver navigating with compose navigation ? I thought hoisting a
LazyListState
up to my
NavHost
would work but it doesn’t apparently
a
should work automatically. have you updated to alpha9?
c
yes
that’s what I thougt but it doesn’t, maybe I’m doing something else wrong
I didn’t mention im also using paging 3
m
I have the same issue. I thought it works but it doesn't. Also using paging 3
c
I’ve been trying stuff but nothing seems to work
t
If you think it is a bug you should try to create a minimal version to show the bug. Than it is also easier to see if you did some thing wrong.
c
yeah I didn’t get to it yet so I was wondering if it was a know issue
g
I have the same issue with compose-router. I also tried remembering the
LazyListState
at the root composable, but whenever the
LazyColumn
is recomposed, the scroll state is reset. Maybe this functionality is not implemented yet?
a
@Cyril Find were you able to find a fix or workaround this issue? I am on Compose alpha-11 and navigation compose alpha 06 and have not been able to solve... Thanks!
c
no, i filed a bug but it's not fixed yet 😞
👍 1
a
@Cyril Find this turned out to be my issue: https://issuetracker.google.com/issues/179397301 since i am not using the paging library. my list state looked like this:
Copy code
val listState = viewModel.gasStations.collectAsState(emptyList())
removing the
emptyList()
like so:
Copy code
val listState = viewModel.gasStations.collectAsState()
fixed my issue for now. Gave yours a anyways.
c
wow that's weird ! thanks for the feedback and the 😄
👍 1