LazyColumn scroll state not restored by Navigation rememberSaveable
0 reputation · 03 Dec 2023, 18:47 UTC
The Jetpack Compose Navigation component relies on rememberSaveable to preserve UI state across configuration changes and process death. However, the scroll offset of a LazyColumn or LazyRow is not automatically saved by this mechanism, leaving the list reset to the top after a rotation or similar event.
Developers who need the scroll position to survive navigation stack transitions must therefore provide an explicit saver for ScrollState or wrap the state in a custom rememberSaveable call. The current behavior is documented as a known limitation, and the Compose team has not yet committed to automatic scroll‑state restoration for lazy lists in the Navigation back stack.
What is the recommended way to persist ScrollState safely without introducing memory leaks? Is there a timeline for integrating automatic scroll‑state saving into the Navigation component? Are there version‑specific workarounds that remain effective for Compose 1.6.x stable releases?