mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-23 23:20:57 +03:00
Removed the albumSong
workaround, as React-Admin's cache seems to behave better now
This commit is contained in:
parent
667701be02
commit
8a56584aed
ui/src
@ -112,7 +112,6 @@ const Admin = (props) => {
|
||||
) : (
|
||||
<Resource name="transcoding" />
|
||||
),
|
||||
<Resource name="albumSong" />,
|
||||
<Resource name="translation" />,
|
||||
<Resource name="playlistTrack" />,
|
||||
<Resource name="keepalive" />,
|
||||
|
@ -33,14 +33,14 @@ const AlbumShowLayout = (props) => {
|
||||
<ReferenceManyField
|
||||
{...context}
|
||||
addLabel={false}
|
||||
reference="albumSong"
|
||||
reference="song"
|
||||
target="album_id"
|
||||
sort={{ field: 'album', order: 'ASC' }}
|
||||
perPage={0}
|
||||
pagination={null}
|
||||
>
|
||||
<AlbumSongs
|
||||
resource={'albumSong'}
|
||||
resource={'song'}
|
||||
exporter={false}
|
||||
album={record}
|
||||
actions={
|
||||
|
@ -115,7 +115,6 @@ const AlbumSongs = (props) => {
|
||||
rating: isDesktop && config.enableStarRating && (
|
||||
<RatingField
|
||||
source="rating"
|
||||
resource={'albumSong'}
|
||||
sortable={false}
|
||||
className={classes.ratingField}
|
||||
/>
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React, { useCallback } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import { useGetOne } from 'react-admin'
|
||||
import { GlobalHotKeys } from 'react-hotkeys'
|
||||
import { LoveButton, useToggleLove } from '../common'
|
||||
@ -10,10 +9,8 @@ const Placeholder = () =>
|
||||
config.enableFavourites && <LoveButton disabled={true} resource={'song'} />
|
||||
|
||||
const Toolbar = ({ id }) => {
|
||||
const location = useLocation()
|
||||
const resource = location.pathname.startsWith('/song') ? 'song' : 'albumSong'
|
||||
const { data, loading } = useGetOne(resource, id)
|
||||
const [toggleLove, toggling] = useToggleLove(resource, data)
|
||||
const { data, loading } = useGetOne('song', id)
|
||||
const [toggleLove, toggling] = useToggleLove('song', data)
|
||||
|
||||
const handlers = {
|
||||
TOGGLE_LOVE: useCallback(() => toggleLove(), [toggleLove]),
|
||||
@ -24,7 +21,7 @@ const Toolbar = ({ id }) => {
|
||||
{config.enableFavourites && (
|
||||
<LoveButton
|
||||
record={data}
|
||||
resource={resource}
|
||||
resource={'song'}
|
||||
disabled={loading || toggling}
|
||||
/>
|
||||
)}
|
||||
|
@ -111,7 +111,7 @@ const ContextMenu = ({
|
||||
const key = e.target.getAttribute('value')
|
||||
if (options[key].needData) {
|
||||
dataProvider
|
||||
.getList('albumSong', songQueryParams)
|
||||
.getList('song', songQueryParams)
|
||||
.then((response) => {
|
||||
let { data, ids } = extractSongsData(response)
|
||||
options[key].action(data, ids)
|
||||
|
@ -19,7 +19,7 @@ export const PlayButton = ({ record, size, className }) => {
|
||||
const dispatch = useDispatch()
|
||||
const playAlbum = (record) => {
|
||||
dataProvider
|
||||
.getList('albumSong', {
|
||||
.getList('song', {
|
||||
pagination: { page: 1, perPage: -1 },
|
||||
sort: { field: 'discNumber, trackNumber', order: 'ASC' },
|
||||
filter: { album_id: record.id, disc_number: record.discNumber },
|
||||
|
@ -6,9 +6,6 @@ const dataProvider = jsonServerProvider(REST_URL, httpClient)
|
||||
|
||||
const mapResource = (resource, params) => {
|
||||
switch (resource) {
|
||||
case 'albumSong':
|
||||
return ['song', params]
|
||||
|
||||
case 'playlistTrack':
|
||||
// /api/playlistTrack?playlist_id=123 => /api/playlist/123/tracks
|
||||
let plsId = '0'
|
||||
|
Loading…
x
Reference in New Issue
Block a user