Fixed: Trying to add an artist when root folders hadn't populated

Fixed #1257
This commit is contained in:
Mark McDowall 2019-11-14 08:32:54 -08:00 committed by Bogdan
parent 110a7b74e7
commit f47e5084e8
1 changed files with 21 additions and 0 deletions

View File

@ -90,6 +90,27 @@ class RootFolderSelectInputConnector extends Component {
}
}
componentDidUpdate(prevProps) {
const {
name,
value,
values,
onChange
} = this.props;
if (prevProps.values === values) {
return;
}
if (!value && values.length && values.some((v) => !!v.key && v.key !== ADD_NEW_KEY)) {
const defaultValue = values[0];
if (defaultValue.key !== ADD_NEW_KEY) {
onChange({ name, value: defaultValue.key });
}
}
}
//
// Render