-
-
Notifications
You must be signed in to change notification settings - Fork 486
feat: Support role filters for (album) artist role for Navidrome #2120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { useSuspenseQueries } from '@tanstack/react-query'; | ||
| import { Suspense, useRef } from 'react'; | ||
| import { useQuery, useSuspenseQuery } from '@tanstack/react-query'; | ||
| import { Suspense, useRef, useState } from 'react'; | ||
| import { useParams } from 'react-router'; | ||
|
|
||
| import { useItemImageUrl } from '/@/renderer/components/item-image/item-image'; | ||
|
|
@@ -34,22 +34,24 @@ const AlbumArtistDetailRouteContent = () => { | |
| }; | ||
|
|
||
| const routeId = (artistId || albumArtistId) as string; | ||
| const [role, setRole] = useState<null | string>(null); | ||
|
|
||
| const [detailQuery, albumsQuery] = useSuspenseQueries({ | ||
| queries: [ | ||
| artistsQueries.albumArtistDetail({ query: { id: routeId }, serverId: server?.id }), | ||
| albumQueries.list({ | ||
| query: { | ||
| artistIds: [routeId], | ||
| limit: -1, | ||
| sortBy: AlbumListSort.RELEASE_DATE, | ||
| sortOrder: SortOrder.DESC, | ||
| startIndex: 0, | ||
| }, | ||
| serverId, | ||
| }), | ||
| ], | ||
| }); | ||
| const detailQuery = useSuspenseQuery( | ||
| artistsQueries.albumArtistDetail({ query: { id: routeId }, serverId: server?.id }), | ||
| ); | ||
| const albumsQuery = useQuery( | ||
| albumQueries.list({ | ||
| query: { | ||
| artistIds: [routeId], | ||
| limit: -1, | ||
| role: role || undefined, | ||
| sortBy: AlbumListSort.RELEASE_DATE, | ||
| sortOrder: SortOrder.DESC, | ||
| startIndex: 0, | ||
| }, | ||
| serverId, | ||
| }), | ||
| ); | ||
|
Comment on lines
+42
to
+54
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||
|
|
||
| const imageUrl = useItemImageUrl({ | ||
| id: detailQuery.data?.imageId || undefined, | ||
|
|
@@ -117,7 +119,12 @@ const AlbumArtistDetailRouteContent = () => { | |
| albumsQuery={albumsQuery} | ||
| ref={headerRef as React.Ref<HTMLDivElement>} | ||
| /> | ||
| <AlbumArtistDetailContent albumsQuery={albumsQuery} detailQuery={detailQuery} /> | ||
| <AlbumArtistDetailContent | ||
| albumsQuery={albumsQuery} | ||
| detailQuery={detailQuery} | ||
| role={role} | ||
| setRole={setRole} | ||
| /> | ||
| </LibraryContainer> | ||
| </NativeScrollArea> | ||
| </AnimatedPage> | ||
|
|
||
There was a problem hiding this comment.
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.