Files
music_library/backlog/completed/ml-72 - TopAlbums-TopArtists-structural-duplication.md
T
2026-05-04 21:22:27 +01:00

1.1 KiB

id, title, status, assignee, created_date, labels, dependencies, references, priority
id title status assignee created_date labels dependencies references priority
ML-72 TopAlbums/TopArtists structural duplication Done
2026-04-20 08:55
https://github.com/cloud8421/music_library/issues/103
low

Description

GitHub: created 2026-03-12 · updated 2026-03-12 · closed 2026-03-12

Description

lib/music_library_web/live/stats_live/top_albums.ex (201 LOC) and top_artists.ex (168 LOC) share near-identical structure: same mount/1, update/2, handle_event/3 callbacks; same time-period tab UI; same assign_async pattern with reset: true. Only the data source and item rendering differ.

Additionally, top_artists_by_period/1 is def (public) while top_albums_by_period/1 is defp (private) — a visibility inconsistency.

Expected behavior

Consider extracting a parameterized TopByPeriod component that accepts data-fetching and rendering callbacks. Fix the def/defp inconsistency.

Source

From technical debt audit (2026-03-12).