Skip to content

Persist audiobooks list/grid view mode per grouping#590

Draft
kevinheneveld wants to merge 2 commits into
Listenarrs:canaryfrom
kevinheneveld:feat/audiobooks-view-mode-per-grouping
Draft

Persist audiobooks list/grid view mode per grouping#590
kevinheneveld wants to merge 2 commits into
Listenarrs:canaryfrom
kevinheneveld:feat/audiobooks-view-mode-per-grouping

Conversation

@kevinheneveld
Copy link
Copy Markdown

Summary

  • The audiobooks library toolbar exposes a list/grid view toggle, persisted to localStorage. Previously the load-from-storage was nested inside an `if (scrollContainer.value)` block that only runs for the Books grouping — so switching to list mode while grouped by Author or Series, then navigating away, would silently revert to grid.
  • This switches to three per-grouping keys (`listenarr.viewMode.books`, `.authors`, `.series`) and reads the relevant one unconditionally on mount + whenever `groupBy` changes. So each grouping independently remembers list vs grid — useful for users who want, e.g., a list of authors but cards for books.
  • A one-time migration seeds all three keys from the legacy `listenarr.viewMode` value the first time it's read, so existing users keep their preference.

Implementation notes

  • Persistence watch moved out from inside `onMounted`'s scrollContainer guard to a top-level watch, so it fires regardless of grouping.
  • Removed the now-unused `stopPersistViewModeWatch` cleanup handle.
  • Initial viewMode is set inline at declaration: `ref<...>(loadViewModeFor(groupBy.value))`.
  • Migration is additive — the legacy key is never deleted, just no longer read once the per-grouping keys exist.

Test plan

  • `cd fe && npm run test:unit` — 350 / 350 passing (2 new tests: per-grouping persistence + legacy migration)
  • `npx vue-tsc --noEmit -p tsconfig.app.json` — clean
  • `cd tests && dotnet test` — passing (no backend changes)

Closes kevinheneveld#3

@kevinheneveld kevinheneveld requested a review from a team May 14, 2026 00:40
@therobbiedavis
Copy link
Copy Markdown
Collaborator

@kevinheneveld Hey there! I appreciate the PR's however I do want to let you know that we're focusing on some foundational changes first and you'll need to rebase your PRs after those are merged, so you may not want to open too many at this time.

@kevinheneveld
Copy link
Copy Markdown
Author

Got it, sorry — opened #591 (a bug fix for automatic search matching music albums) before I saw this note. Happy to wait. I'll convert these to draft so they're out of your review queue until the foundational changes land, and I'll rebase them then. No rush from my end.

@kevinheneveld kevinheneveld marked this pull request as draft May 14, 2026 01:43
@kevinheneveld kevinheneveld force-pushed the feat/audiobooks-view-mode-per-grouping branch from a0b2fc2 to 9ca9299 Compare May 17, 2026 22:44
@kevinheneveld
Copy link
Copy Markdown
Author

Quick update — all five of my open PRs (#580, #585, #589, #590, #591) have been rebased onto canary (v0.4.1). #585, #589, #590, #591 are still drafted per your earlier note; #580 is the nzbget auth fix and is ready when you have time. Whenever the foundation phase feels open enough for the feature PRs again, happy to undraft any/all of them. No urgency.

Kevin Heneveld added 2 commits May 19, 2026 08:13
The audiobooks toolbar exposes a list/grid toggle, but the grouped view
template only rendered a grid — toggling to list mode while grouped by
author or series was silently ignored. The list template only existed
inside the `groupBy === 'books'` branch.

This adds a parallel list rendering for grouped collections:
- Row per collection (cover thumb, name, book count)
- Clicking a row navigates to the collection page (matches grid behavior)
- Keyboard accessible (Enter / Space activate the row)

CSS reuses the existing `.audiobooks-list` / `.audiobook-list-item`
patterns; the row layout has its own three-column grid template
(cover / name / count) since collection rows don't carry status badges
or per-item actions.

Tests added for both authors and series groupings in list mode.

(cherry picked from commit 284cea4)
The view mode toggle's persistence was previously gated by scrollContainer
being mounted, which only happens for groupBy === 'books'. So switching
to list mode while grouped by author or series, then navigating away and
back, would silently revert to grid.

Switches to three localStorage keys (one per grouping: books, authors,
series), reads the relevant key unconditionally on mount, and re-reads
when groupBy changes — so each grouping can independently remember
list vs grid. A one-time migration seeds all three keys from the legacy
listenarr.viewMode value when first encountered, so existing users keep
their preference.

Persistence watch moved to top level so it's no longer gated by the
scrollContainer guard.

Closes #3

(cherry picked from commit a0b2fc2)
@kevinheneveld kevinheneveld force-pushed the feat/audiobooks-view-mode-per-grouping branch from 9ca9299 to e9fd9f6 Compare May 19, 2026 16:14
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.

[Enhancement] Persist list/grid view mode per audiobooks grouping

3 participants