Skip to content

fix: preserve scroll position when returning to library tabs#2576

Closed
stamchry wants to merge 1 commit into
PixelPlayerHQ:masterfrom
stamchry:feature/preserve-library-scroll-state
Closed

fix: preserve scroll position when returning to library tabs#2576
stamchry wants to merge 1 commit into
PixelPlayerHQ:masterfrom
stamchry:feature/preserve-library-scroll-state

Conversation

@stamchry

@stamchry stamchry commented Jul 9, 2026

Copy link
Copy Markdown

Overview

This fixes an annoying UX issue where navigating away from a library tab (like clicking on an album in the Albums tab) and then pressing back would jump you all the way back to the top of the list.

What changed

I moved the scroll states (LazyListState and LazyGridState) out of the individual tabs (Albums, Artists, Songs) and hoisted them up to the parent LibraryScreen.

Previously, because the scroll states lived inside the tab composables themselves, they were getting wiped out whenever the Navigation system or the HorizontalPager had to recreate the view upon returning. By holding the states at the LibraryScreen level, the screen's saveable state registry can properly hold onto them while we navigate back and forth.

How to test

  1. Open the app and go to the Albums tab.
  2. Scroll down a bit and click on any album to open its details.
  3. Press back. You should be exactly where you left off instead of at the top.

@stamchry stamchry closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant