Skip to content

Remember the library sort across visits - #788

Open
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:fix/persist-library-sort
Open

Remember the library sort across visits#788
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:fix/persist-library-sort

Conversation

@dny238

@dny238 dny238 commented Jul 31, 2026

Copy link
Copy Markdown

Fixes #787

What

The Audiobooks library reset its sort to Title on every visit, discarding whatever the user last selected. This persists the sort so the last choice is kept as the user's preference.

How

AudiobooksView.vuesortState (the per-grouping { key, order }) now hydrates from localStorage (listenarr.sortState) on init and is saved on change via a deep watch, mirroring the existing listenarr.groupBy / listenarr.searchQuery handling on this same view. Saved entries are validated (order must be asc/desc); anything malformed falls back to DEFAULT_SORTS, and the existing grouping-change guard still resets a saved key that isn't valid for the current grouping.

Tests

Adds two tests to AudiobooksView.spec.ts: changing the sort writes it to localStorage, and a saved sort is restored on mount instead of defaulting to Title.

  • vue-tsc type-check clean
  • vitest AudiobooksView.spec.ts — 12/12 pass

🤖 Generated with Claude Code

The Audiobooks library reset its sort to Title on every visit, discarding
whatever the user last chose. The per-group sort state now persists to
localStorage (listenarr.sortState) and is restored on load, so the last
sort key and direction are kept as the user's preference. Invalid saved
keys still fall back to the group default (existing grouping-change guard).

Adds tests covering persist-on-change and restore-on-mount.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dny238
dny238 requested a review from a team July 31, 2026 16:56
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.

Library sort resets to Title on every visit (not remembered)

1 participant