Fix potential undefined property

Not sure the reason, but I got this error:

```
Cannot read property 'id' of undefined
    at tn (SongTitleField.js:35)
    at Ka (react-dom.production.min.js:153)
    at vl (react-dom.production.min.js:261)
    at sc (react-dom.production.min.js:246)
    at lc (react-dom.production.min.js:246)
```
This commit is contained in:
Deluan 2020-09-02 12:41:21 -04:00
parent 596a4897a3
commit 8549451ee7
2 changed files with 9 additions and 2 deletions

View File

@ -100,8 +100,8 @@ const SongContextMenu = ({
}
SongContextMenu.propTypes = {
resource: PropTypes.string,
record: PropTypes.object,
resource: PropTypes.string.isRequired,
record: PropTypes.object.isRequired,
onAddToPlaylist: PropTypes.func,
visible: PropTypes.bool,
showStar: PropTypes.bool,
@ -109,6 +109,8 @@ SongContextMenu.propTypes = {
SongContextMenu.defaultProps = {
onAddToPlaylist: () => {},
record: {},
resource: 'song',
visible: true,
showStar: true,
addLabel: true,

View File

@ -76,4 +76,9 @@ SongTitleField.propTypes = {
showTrackNumbers: PropTypes.bool,
}
SongTitleField.defaultProps = {
record: {},
showTrackNumbers: false,
}
export default SongTitleField