Keep optimistic rendering when changing the sort order for the current album
This commit is contained in:
@@ -24,6 +24,7 @@ const AlbumShow = (props) => {
|
|||||||
<AlbumDetails {...props} classes={classes} record={record} />
|
<AlbumDetails {...props} classes={classes} record={record} />
|
||||||
<AlbumSongs
|
<AlbumSongs
|
||||||
{...props}
|
{...props}
|
||||||
|
albumId={props.id}
|
||||||
title={<Title subTitle={record.name} />}
|
title={<Title subTitle={record.name} />}
|
||||||
actions={<AlbumActions />}
|
actions={<AlbumActions />}
|
||||||
filter={{ album_id: props.id }}
|
filter={{ album_id: props.id }}
|
||||||
|
|||||||
@@ -58,12 +58,16 @@ const AlbumSongs = (props) => {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
||||||
const controllerProps = useListController(props)
|
const controllerProps = useListController(props)
|
||||||
const { bulkActionButtons } = props
|
const { bulkActionButtons, albumId } = props
|
||||||
const { loading, version } = controllerProps
|
const { loading, data, ids, version } = controllerProps
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return null
|
const anySong = data[ids[0]]
|
||||||
|
if (!anySong || anySong.albumId !== albumId) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListToolbar
|
<ListToolbar
|
||||||
|
|||||||
Reference in New Issue
Block a user