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
parent fbe6ecea95
commit 48847ae479
+6 -4
View File
@@ -166,7 +166,8 @@ const ContextMenu = ({
) )
} }
export const AlbumContextMenu = (props) => ( export const AlbumContextMenu = (props) =>
props.record ? (
<ContextMenu <ContextMenu
{...props} {...props}
resource={'album'} resource={'album'}
@@ -176,7 +177,7 @@ export const AlbumContextMenu = (props) => (
filter: { album_id: props.record.id, disc_number: props.discNumber }, filter: { album_id: props.record.id, disc_number: props.discNumber },
}} }}
/> />
) ) : null
AlbumContextMenu.propTypes = { AlbumContextMenu.propTypes = {
record: PropTypes.object, record: PropTypes.object,
@@ -190,7 +191,8 @@ AlbumContextMenu.defaultProps = {
addLabel: true, addLabel: true,
} }
export const ArtistContextMenu = (props) => ( export const ArtistContextMenu = (props) =>
props.record ? (
<ContextMenu <ContextMenu
{...props} {...props}
resource={'artist'} resource={'artist'}
@@ -200,7 +202,7 @@ export const ArtistContextMenu = (props) => (
filter: { album_artist_id: props.record.id }, filter: { album_artist_id: props.record.id },
}} }}
/> />
) ) : null
ArtistContextMenu.propTypes = { ArtistContextMenu.propTypes = {
record: PropTypes.object, record: PropTypes.object,