remove _custom query usage for playlists

This commit is contained in:
jeffvli
2025-12-03 18:31:42 -08:00
parent a47f94ebb2
commit cb2581252b
10 changed files with 37 additions and 83 deletions
@@ -327,11 +327,6 @@ export const AlbumDetailContent = () => {
excludeIds: detailQuery?.data?.id ? [detailQuery.data.id] : undefined,
isHidden: !detailQuery?.data?.albumArtists?.[0]?.id,
query: {
_custom: {
jellyfin: {
ExcludeItemIds: detailQuery?.data?.id,
},
},
artistIds: detailQuery?.data?.albumArtists.length
? [detailQuery?.data?.albumArtists[0].id]
: undefined,
@@ -346,11 +341,11 @@ export const AlbumDetailContent = () => {
excludeIds: detailQuery?.data?.id ? [detailQuery.data.id] : undefined,
isHidden: !detailQuery?.data?.genres?.[0],
query: {
genres: detailQuery?.data?.genres.length
genreIds: detailQuery?.data?.genres.length
? [detailQuery?.data?.genres[0].id]
: undefined,
},
rowCount: 2,
rowCount: 1,
sortBy: AlbumListSort.RANDOM,
sortOrder: SortOrder.ASC,
title: `${t('page.albumDetail.moreFromGeneric', {
@@ -38,11 +38,7 @@ export const AddToPlaylistAction = ({ items, itemType }: AddToPlaylistActionProp
const playlistsQuery = useQuery(
playlistsQueries.list({
query: {
_custom: {
navidrome: {
smart: false,
},
},
excludeSmartPlaylists: true,
sortBy: PlaylistListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
@@ -74,11 +74,7 @@ export const AddToPlaylistContextModal = ({
const playlistList = useQuery(
playlistsQueries.list({
query: {
_custom: {
navidrome: {
smart: false,
},
},
excludeSmartPlaylists: true,
sortBy: PlaylistListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
@@ -33,13 +33,9 @@ export const CreatePlaylistForm = ({ onCancel }: CreatePlaylistFormProps) => {
const form = useForm<CreatePlaylistBody>({
initialValues: {
_custom: {
navidrome: {
rules: undefined,
},
},
comment: '',
name: '',
queryBuilderRules: undefined,
},
});
const [isSmartPlaylist, setIsSmartPlaylist] = useState(false);
@@ -79,14 +75,7 @@ export const CreatePlaylistForm = ({ onCancel }: CreatePlaylistFormProps) => {
apiClientProps: { serverId: server.id },
body: {
...values,
_custom: {
navidrome: {
...values._custom?.navidrome,
rules,
},
// Top-level rules field is what Navidrome expects for smart playlists.
...(rules ? { rules } : {}),
},
...(rules ? { queryBuilderRules: rules } : {}),
},
},
{
@@ -36,15 +36,10 @@ export const SaveAsPlaylistForm = ({
const form = useForm<CreatePlaylistBody>({
initialValues: {
_custom: {
navidrome: {
rules: undefined,
...body?._custom?.navidrome,
},
},
comment: body.comment || '',
name: body.name || '',
public: body.public,
queryBuilderRules: body.queryBuilderRules,
},
});
@@ -48,17 +48,12 @@ export const UpdatePlaylistForm = ({ body, onCancel, query, users }: UpdatePlayl
const form = useForm<UpdatePlaylistBody>({
initialValues: {
_custom: {
navidrome: {
owner: body?._custom?.navidrome?.owner || '',
ownerId: body?._custom?.navidrome?.ownerId || '',
rules: undefined,
sync: body?._custom?.navidrome?.sync || false,
},
},
comment: body?.comment || '',
name: body?.name || '',
ownerId: body.ownerId,
public: body.public,
queryBuilderRules: body.queryBuilderRules,
sync: body.sync,
},
});
@@ -114,7 +109,7 @@ export const UpdatePlaylistForm = ({ body, onCancel, query, users }: UpdatePlayl
{isOwnerDisplayed && (
<Select
data={userList || []}
{...form.getInputProps('_custom.navidrome.ownerId')}
{...form.getInputProps('ownerId')}
label={t('form.createPlaylist.input', {
context: 'owner',
postProcess: 'titleCase',
@@ -191,18 +186,13 @@ export const openUpdatePlaylistModal = async (args: {
children: (
<UpdatePlaylistForm
body={{
_custom: {
navidrome: {
owner: playlist?.owner || undefined,
ownerId: playlist?.ownerId || undefined,
rules: playlist?.rules || undefined,
sync: playlist?.sync || undefined,
},
},
comment: playlist?.description || undefined,
genres: playlist?.genres,
name: playlist?.name,
ownerId: playlist?.ownerId || undefined,
public: playlist?.public || false,
queryBuilderRules: playlist?.rules || undefined,
sync: playlist?.sync || undefined,
}}
onCancel={closeAllModals}
query={{ id: playlist?.id }}
@@ -280,15 +280,12 @@ const PlaylistDetailSongListRoute = () => {
{
apiClientProps: { serverId: detailQuery?.data?._serverId },
body: {
_custom: {
owner: detailQuery?.data?.owner || '',
ownerId: detailQuery?.data?.ownerId || '',
rules,
sync: detailQuery?.data?.sync || false,
},
comment: detailQuery?.data?.description || '',
name: detailQuery?.data?.name,
ownerId: detailQuery?.data?.ownerId || '',
public: detailQuery?.data?.public || false,
queryBuilderRules: rules,
sync: detailQuery?.data?.sync || false,
},
},
{
@@ -332,19 +329,12 @@ const PlaylistDetailSongListRoute = () => {
children: (
<SaveAsPlaylistForm
body={{
_custom: {
navidrome: {
owner: detailQuery?.data?.owner || '',
ownerId: detailQuery?.data?.ownerId || '',
rules,
sync: detailQuery?.data?.sync || false,
},
rules,
sync: detailQuery?.data?.sync || false,
},
comment: detailQuery?.data?.description || '',
name: detailQuery?.data?.name,
ownerId: detailQuery?.data?.ownerId || '',
public: detailQuery?.data?.public || false,
queryBuilderRules: rules,
sync: detailQuery?.data?.sync || false,
}}
onCancel={closeAllModals}
onSuccess={(data) =>