Removed the albumSong workaround, as React-Admin's cache seems to behave better now

This commit is contained in:
Deluan
2021-06-15 11:31:41 -04:00
parent 667701be02
commit 8a56584aed
7 changed files with 7 additions and 15 deletions
+3 -6
View File
@@ -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}
/>
)}