Don't break if it tries to render ContextMenu without data. Fix #776

This commit is contained in:
Deluan 2021-02-13 12:04:02 -05:00 committed by Joe Stump
parent e973377a65
commit a59f2c1e4b
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -166,7 +166,8 @@ const ContextMenu = ({
)
}
export const AlbumContextMenu = (props) => (
export const AlbumContextMenu = (props) =>
props.record ? (
<ContextMenu
{...props}
resource={'album'}
@ -176,7 +177,7 @@ export const AlbumContextMenu = (props) => (
filter: { album_id: props.record.id, disc_number: props.discNumber },
}}
/>
)
) : null
AlbumContextMenu.propTypes = {
record: PropTypes.object,
@ -190,7 +191,8 @@ AlbumContextMenu.defaultProps = {
addLabel: true,
}
export const ArtistContextMenu = (props) => (
export const ArtistContextMenu = (props) =>
props.record ? (
<ContextMenu
{...props}
resource={'artist'}
@ -200,7 +202,7 @@ export const ArtistContextMenu = (props) => (
filter: { album_artist_id: props.record.id },
}}
/>
)
) : null
ArtistContextMenu.propTypes = {
record: PropTypes.object,