# Library grouping and category overrides

Open a library's filter/settings sheet → Display → **Group library by**. Each media
type independently remembers Categories, Source, Status, Tracker status, Tags, or
Ungrouped. All implementations are shared by Android, iOS, desktop and web.

Categories remains the default and preserves manual assignments, ordering and hidden
categories. Automatic grouping creates views without writing category assignments.
Source views distinguish source IDs even when names are equal, with a legacy name/
language fallback for entries without IDs. Status uses the title's stored status.
Tracker status includes every distinct status across bound providers; an entry may
appear in several status views, with a separate Untracked view. Tag views trim
whitespace and merge case variants, include a title once per tag, and retain an
Untagged view. Ungrouped shows the entire filtered library.

Group tabs are derived from the unfiltered library, so searching/filtering keeps
their identities and shows zero counts rather than reshuffling or removing them.
Automatic IDs are stable and distinct from manual category IDs, Uncategorized and
the All view. Hash collisions are detected and resolved in a deterministic order.
The All tab makes all-category searches and bulk selection refer to the page that
is actually visible. Tab navigation works for manual and automatic groups.

Select a manual category, open the library settings sheet, and enable **Custom
display and sort for …** to store that category's card layout, grid size, badges,
continue buttons and sort order. Initial values copy the current global settings.
Changes in that scope preserve global settings and other categories/media types.
Disable the option to return to inherited settings. Tab visibility and library-wide
counts remain global. The All page and automatic groups use global settings.
Deleting a category removes its overrides. Preferences persist per profile and follow
the existing device-local feature preference backup/sync policy.

Membership building uses one pass over library entries followed by one pass over
sorted matches, rather than a full-library scan for every source/tag/status. More
than 64 tabs use a lazy row with stable keys; only visible tabs are composed. Existing
small tab rows retain their Material behavior. Source/tag labels are bounded in width
in the lazy row, and long labels ellipsize.
Tabs fit their label width within those bounds. Distant programmatic jumps align
immediately; selecting a visible tab retains the short scroll animation.

Tracker metadata is projected once in the shared library index. Provider/status/score
changes publish a new index without regrouping chapters; refresh timestamps and remote
progress-only writes do not publish another index. Selected chapter releases are reused
when only tracker metadata or completed-download counts change. Grouping, sorting and
category layout changes do not reselect chapter releases or read the database per title.

Verification: 43 targeted desktop checks and 29 Kotlin/Wasm browser tests passed,
with compilation for Android, iOS simulator ARM64, desktop and web. The desktop
render check lays out 1,000 tag groups at 360px and 1024px widths and navigates to
the last group. The inspected renders are generated under
`composeApp/build/reports/library-ui/`. These checks do not claim native-device
runtime coverage or a measured frame rate.
