mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
Select current revision in selector if it is a branch
This commit is contained in:
@@ -17,6 +17,7 @@ const styles = {
|
||||
type Props = {
|
||||
branches: Branch[], // TODO: Use generics?
|
||||
selected: (branch?: Branch) => void,
|
||||
selectedBranch: string,
|
||||
|
||||
// context props
|
||||
classes: Object,
|
||||
@@ -31,6 +32,12 @@ class BranchSelector extends React.Component<Props, State> {
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.branches
|
||||
.filter(branch => branch.name === this.props.selectedBranch)
|
||||
.forEach(branch => this.setState({ selectedBranch: branch }));
|
||||
}
|
||||
|
||||
render() {
|
||||
const { branches, classes, t } = this.props;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user