Fix some JS console errors
This commit is contained in:
@@ -17,7 +17,14 @@ import { formatBytes } from '../utils'
|
|||||||
import { useMediaQuery } from '@material-ui/core'
|
import { useMediaQuery } from '@material-ui/core'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
|
|
||||||
const AlbumActions = ({ className, ids, data, record, ...rest }) => {
|
const AlbumActions = ({
|
||||||
|
className,
|
||||||
|
ids,
|
||||||
|
data,
|
||||||
|
record,
|
||||||
|
permanentFilter,
|
||||||
|
...rest
|
||||||
|
}) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
||||||
|
|||||||
@@ -32,5 +32,4 @@ export const AddToPlaylistButton = ({ resource, selectedIds, className }) => {
|
|||||||
AddToPlaylistButton.propTypes = {
|
AddToPlaylistButton.propTypes = {
|
||||||
resource: PropTypes.string.isRequired,
|
resource: PropTypes.string.isRequired,
|
||||||
selectedIds: PropTypes.arrayOf(PropTypes.string).isRequired,
|
selectedIds: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
className: PropTypes.object,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,5 +58,4 @@ BatchPlayButton.propTypes = {
|
|||||||
action: PropTypes.func.isRequired,
|
action: PropTypes.func.isRequired,
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
icon: PropTypes.object.isRequired,
|
icon: PropTypes.object.isRequired,
|
||||||
className: PropTypes.object,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import React, { useState, isValidElement, cloneElement, useMemo } from 'react'
|
import React, {
|
||||||
|
useState,
|
||||||
|
isValidElement,
|
||||||
|
cloneElement,
|
||||||
|
useMemo,
|
||||||
|
useCallback,
|
||||||
|
} from 'react'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
import { Datagrid, DatagridBody, DatagridRow } from 'react-admin'
|
import { Datagrid, DatagridBody, DatagridRow } from 'react-admin'
|
||||||
import { TableCell, TableRow, Typography } from '@material-ui/core'
|
import { TableCell, TableRow, Typography } from '@material-ui/core'
|
||||||
@@ -106,7 +112,7 @@ export const SongDatagridRow = ({
|
|||||||
SongDatagridRow.propTypes = {
|
SongDatagridRow.propTypes = {
|
||||||
record: PropTypes.object,
|
record: PropTypes.object,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
multiDisc: PropTypes.bool,
|
firstTracks: PropTypes.instanceOf(Set),
|
||||||
contextAlwaysVisible: PropTypes.bool,
|
contextAlwaysVisible: PropTypes.bool,
|
||||||
onClickDiscSubtitle: PropTypes.func,
|
onClickDiscSubtitle: PropTypes.func,
|
||||||
}
|
}
|
||||||
@@ -123,10 +129,13 @@ export const SongDatagrid = ({
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { ids, data } = rest
|
const { ids, data } = rest
|
||||||
|
|
||||||
const playDisc = (discNumber) => {
|
const playDisc = useCallback(
|
||||||
|
(discNumber) => {
|
||||||
const idsToPlay = ids.filter((id) => data[id].discNumber === discNumber)
|
const idsToPlay = ids.filter((id) => data[id].discNumber === discNumber)
|
||||||
dispatch(playTracks(data, idsToPlay))
|
dispatch(playTracks(data, idsToPlay))
|
||||||
}
|
},
|
||||||
|
[dispatch, data, ids]
|
||||||
|
)
|
||||||
|
|
||||||
const firstTracks = useMemo(() => {
|
const firstTracks = useMemo(() => {
|
||||||
const set = new Set(
|
const set = new Set(
|
||||||
|
|||||||
Reference in New Issue
Block a user