Skip to content

Browse sort resets to the default after opening a title (TV) or relaunching (phone) #236

Closed

Description

@Quick104

Report

Select MOVIES/SERIES on browse, SORT by anything > SELECT title to view info > hit back and SORT goes back to default so have to start from scratch.

Reproduced on both clients, from two independent causes. Filters survive in both cases; only the sort is lost, which is what makes it read as "start from scratch".

Android TV — sort lost on Back from item detail

  1. Movies → cascade → Browse
  2. Sort → Year (grid reorders, chip reads Sort · Year Newest)
  3. Open any title → Back
  4. Grid is back in Title A–Z and the chip reads Sort · Title A–Z

Focus restoration works (Back lands on the card you opened), which makes the reset look like a reload rather than a lost setting.

Cause. The TvLibraryDetailViewModel survives the Back — verified with a temporary log, same instance either side. But TvLibraryDetailScreen re-issues the committed cascade section every time it re-enters composition:

LaunchedEffect(sectionRequestNonce, initialSection) { initialSection?.let(viewModel::onTabSelected) }

onTabSelected guarded with if (state.selectedTab == tab && !filterChanged) return. On re-entry the tab is unchanged but filterChanged is true precisely because the viewer customised the sort, so the guard falls through and forTab(Browse) stomps sort and facets back to Title A–Z. The log line on return:

onTabSelected tab=Browse current=Browse filter=year/desc

Android phone — sort lost on relaunch

  1. Libraries → Movies → Library subtab
  2. Sort → Title, and apply any filter (e.g. Unwatched)
  3. Force-stop and relaunch → Library subtab
  4. The Unwatched chip is restored; the sort is back to Recently Added

Cause. LibrariesViewModel keeps the sort in LibrariesUiState.browseSort, outside the CatalogFilterState that BrowsePrefsStore persists. selectBrowseSort never saves, and every restore path (refresh, selectLibrary) restores the filter state but lets browseSort fall back to RecentlyAdded. The persisted JSON showed the facets and no sort:

{"selections":{"WatchStatus":["unwatched"]}}

This contradicts the store's own doc ("Persists browse filter + sort state") and the user-facing toggle named "Preserve sort & filters". The standalone BrowseViewModel already persists sort inside filterState; the Libraries browse grid diverged.

Expected

  • Returning from item detail leaves the sort exactly as the viewer set it.
  • With "Preserve sort & filters" on, the sort is restored alongside the filters.

Activity

  1. added
    bug
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions