Skip to content

fix(library): remember the chosen sort across restarts - #808

Closed
kevenchantre wants to merge 1 commit into
mornyeapp:mainfrom
kevenchantre:library-sort
Closed

kevenchantre wants to merge 1 commit into
mornyeapp:mainfrom
kevenchantre:library-sort

Conversation

@kevenchantre

@kevenchantre kevenchantre commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Library's sort lived only in the open Library screen (_sortMode in queue_tab.dart, initialised to 'latest') and was never saved, so a chosen sort such as Title (A–Z) reset to Latest every time the app restarted (#776).

  • New setting librarySortMode (default latest), next to historyFilterMode, which already remembers the last Library tab. The valid values are one shared list, AppSettings.librarySortModes, which the sort menus now also use.
  • The Library opens with the saved sort and saves it whenever it changes: the sort menu, the desktop table headers and the filter sheet. Reset in the filter sheet saves Latest.
  • Unknown or removed values fall back to Latest, both when loading settings and in setLibrarySortMode.
  • Playlists have no size sort. With a saved size sort, the Playlists page shows Latest without replacing the saved sort, and Songs and Albums apply it again.
  • Scope: the Mornye style's Library overview keeps its own short sort menu. Its Songs, Albums and other sections open the same Library page and use the saved sort.

Related Issues

Fixes #776

Type of Change

  • Bug fix
  • Feature
  • Performance improvement
  • Refactor with no intended behavior change
  • Tests, build, or repository maintenance
  • Documentation or localization

Validation

  • dart format --output=none --set-exit-if-changed lib test integration_test
  • flutter analyze
  • flutter test
  • bash scripts/check_rust_backend.sh
  • Android or iOS native checks
  • Manual reproduction or device test

Validation notes:

  • New test/library_sort_setting_test.dart: Latest by default; a chosen sort is saved and loaded again; every offered sort is kept; unknown values fall back to Latest.
  • test/library_toolbar_test.dart: the Library opens with the saved sort (Material and Mornye, phone and desktop); choosing a size sort saves it; Playlists show Latest without replacing a saved size sort, and Songs applies it again; Reset in the filter sheet saves Latest.
  • lib/models/settings.g.dart matches build_runner output.
  • No Rust or native code changed.

The Library's sort lived only in the open Library screen and started at
Latest every time the app opened, so a chosen sort such as Title (A-Z)
was lost on every restart.

The sort is now a setting (librarySortMode, default Latest), loaded when
the Library opens and saved whenever it changes from the sort menu, the
table headers or the filter sheet; Reset saves Latest. Unknown values
fall back to Latest. Playlists have no size sort, so with a saved size
sort they show Latest without replacing it, and the other pages apply it
again.

Fixes mornyeapp#776
@zarzet zarzet closed this Nov 4, 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.

[Bug]: persistent sort songs feature

2 participants