Remember the library sort across visits - #788
Open
dny238 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.vue—sortState(the per-grouping{ key, order }) now hydrates fromlocalStorage(listenarr.sortState) on init and is saved on change via a deepwatch, mirroring the existinglistenarr.groupBy/listenarr.searchQueryhandling on this same view. Saved entries are validated (ordermust beasc/desc); anything malformed falls back toDEFAULT_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 tolocalStorage, and a saved sort is restored on mount instead of defaulting to Title.vue-tsctype-check cleanvitest AudiobooksView.spec.ts— 12/12 pass🤖 Generated with Claude Code