Skip to content

fix: normalise author group keys to prevent duplicate author cards (#672)#673

Open
s3ntin3l8 wants to merge 1 commit into
Listenarrs:canaryfrom
s3ntin3l8:672-author-grouping-normalization
Open

fix: normalise author group keys to prevent duplicate author cards (#672)#673
s3ntin3l8 wants to merge 1 commit into
Listenarrs:canaryfrom
s3ntin3l8:672-author-grouping-normalization

Conversation

@s3ntin3l8

@s3ntin3l8 s3ntin3l8 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

When metadata returns slightly different formatting for the same author or series name (e.g. "George R.R. Martin" vs "George R. R. Martin", or "Wheel of Time" vs "wheel of time"), the Library overview created duplicate cards instead of merging them. This extracts the existing normalisation helper from CollectionView.vue into shared utils and applies it to the grouping step in AudiobooksView.vue.

Changes

Added

  • normalizeCollectionText exported from fe/src/utils/textUtils.ts (extracted from the local copy in CollectionView.vue)
  • Regression tests for the duplicate author-card and series-card failure modes

Changed

  • CollectionView.vue now imports normalizeCollectionText from textUtils instead of defining it locally
  • AudiobooksView.vue groupedCollections normalises the Map key for both author and series grouping, so name variants differing only in case/spacing/punctuation merge into one card; the raw first-seen name is preserved for display

Fixed

  • Author and series overviews no longer create separate cards for the same author/series when the name differs only in punctuation/whitespace/case across books

Testing

  • cd fe && npm run test:unit — 380 tests, 0 failures
  • cd fe && npm run type-check — clean
  • Manually verified against a library where "George R.R. Martin" and "George R. R. Martin" appeared as separate author cards; after the fix a single card shows all books

Notes

Fixes #672. normalizeCollectionText was already used in CollectionView.vue's matchesCurrentCollection (for both author and series names), which is why clicking either duplicate card already showed all books — the fix just brings the grouping step in sync.

🤖 Generated with Claude Code

@s3ntin3l8 s3ntin3l8 requested a review from a team June 10, 2026 13:34
s3ntin3l8 added a commit to s3ntin3l8/Listenarr that referenced this pull request Jun 10, 2026
508-storage-per-root-folder landed upstream as PR Listenarrs#656 and is now in
upstream/canary, so keeping it in PATCH_BRANCHES would cause conflicts.
672-author-grouping-normalization (PR Listenarrs#673) is the new open patch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ate duplicate cards

Extracts normalizeCollectionText to textUtils.ts and imports it in both
AudiobooksView and CollectionView (replacing the local copy there).
AudiobooksView.groupedCollections now normalises the Map key for both
authors and series, so variants differing only in case/spacing/punctuation
(e.g. "R.R." vs "R. R.", "Wheel of Time" vs "wheel of time") merge into a
single card while the first-seen raw name is preserved for display. This
keeps grouping in sync with CollectionView.matchesCurrentCollection, which
already normalises both author and series names. Fixes Listenarrs#672.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kevinheneveld

Copy link
Copy Markdown
Contributor

Heads-up on a small overlap: in #680 (unified library search) I independently added a normalizeCollectionText to fe/src/utils/textUtils.ts that's byte-for-byte identical to the one this PR introduces — same NFKD → strip-diacritics → lowercase → collapse-non-alphanumerics helper. So whichever of these two lands second will hit a duplicate-export conflict.

Easy to resolve either direction: happy to drop mine and have #680 consume yours, or vice-versa — whatever's simplest for the maintainers. No change needed on your end unless #673 lands first, in which case I'll rebase #680 onto it. Just flagging so it's visible before either merges.

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] Author overview creates duplicate cards when metadata has inconsistent author name spacing (e.g. "R.R." vs "R. R.")

2 participants