Skip to content

feat: Support role filters for (album) artist role for Navidrome - #2120

Open
kgarner7 wants to merge 1 commit into
developmentfrom
navidrome-artist-album-role-filter
Open

feat: Support role filters for (album) artist role for Navidrome#2120
kgarner7 wants to merge 1 commit into
developmentfrom
navidrome-artist-album-role-filter

Conversation

@kgarner7

@kgarner7 kgarner7 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator
  • Adds an optional (Navidrome only, currently) field roles to type AlbumArtist
  • roles is populated using artist.stats (excludign maincredit)
  • getAlbumList supports a role filter; if specified, only filter artists with that role (ND only)
  • Album list on artist page can filter by role if specified (only one)
  • Album query is no longer suspend, as it can change multiple times

- Adds an optional (Navidrome only, currently) field `roles` to type `AlbumArtist`
- `roles` is populated using artist.stats (excludign maincredit)
- `getAlbumList` supports a role filter; if specified, only filter artists with that role (ND only)
- Album list on artist page can filter by role if specified (only one)
- Album query is no longer suspend, as it can change multiple times
@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
feishin Ready Ready Preview, Comment Jun 5, 2026 4:10am

Comment on lines +1540 to +1550
{roles?.length && (
<Select
aria-label="role"
clearable
data={roles}
onChange={setRole}
placeholder={t('common.role')}
value={role}
w={200}
/>
)}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Select input clashes with the rest of the design on the page.

It would be better to incorporate this into the existing settings dropdown with the toggle for "all release types" or "primary release types". It should probably use the Submenus on the DropdownMenu component to begin separating these out.

Comment on lines +42 to +54
const albumsQuery = useQuery(
albumQueries.list({
query: {
artistIds: [routeId],
limit: -1,
role: role || undefined,
sortBy: AlbumListSort.RELEASE_DATE,
sortOrder: SortOrder.DESC,
startIndex: 0,
},
serverId,
}),
);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is no longer a suspense query, you need to properly handle cases when data is loading.

The handlePlay in the header will just silently fail if you try to click the play buttons while the album query is loading. Similarly, there is no loading UI for the album list. So if the request takes a while, the user might think that it is bugged if no albums are showing up.

Instead, you may just want to reorganize the page composition so that you're no longer fetching the list endpoint in the root component, and instead:

  1. Revert to suspense query and localize the albumsQuery directly in the ArtistAlbums and wrap it in a Suspense container. No longer prop drill the albumsQuery down to header/content components
  2. Lift up the search/filter row for the ArtistAlbums so that it is not affected by the new Suspense container
  3. Pass down the role state to the header (or better add it as a route param so that we can just use useParams to reference it). In the header, just use queryClient.ensureQueryData or similar so that we can fetch from the cache or refetch if not available for the play instead of just silently failing

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.

2 participants