fixed issue: Cannot read property 'find' of undefined for changesets

This commit is contained in:
Florian Scholdei
2019-04-24 16:55:24 +02:00
parent d2c2a1b23c
commit 1cd6872afe

View File

@@ -41,11 +41,14 @@ class BranchSelector extends React.Component<Props, State> {
} }
componentDidMount() { componentDidMount() {
const selectedBranch = this.props.branches.find( const { branches } = this.props;
if (branches) {
const selectedBranch = branches.find(
branch => branch.name === this.props.selectedBranch branch => branch.name === this.props.selectedBranch
); );
this.setState({ selectedBranch }); this.setState({ selectedBranch });
} }
}
render() { render() {
const { branches, classes, label, disabled } = this.props; const { branches, classes, label, disabled } = this.props;