Don't explode when record is not loaded yet

This commit is contained in:
Deluan 2020-11-28 09:44:07 -05:00 committed by Joe Stump
parent 1546d7fb15
commit 8d2b5bd259
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { useDataProvider, useNotify } from 'react-admin'
import subsonic from '../subsonic'
export const useToggleStar = (resource, record) => {
export const useToggleStar = (resource, record = {}) => {
const [loading, setLoading] = useState(false)
const notify = useNotify()