diff --git a/scm-ui/src/repos/branches/components/BranchForm.js b/scm-ui/src/repos/branches/components/BranchForm.js index 67440620cb..2938b06a2a 100644 --- a/scm-ui/src/repos/branches/components/BranchForm.js +++ b/scm-ui/src/repos/branches/components/BranchForm.js @@ -30,7 +30,8 @@ class BranchForm extends React.Component { super(props); this.state = { - nameValidationError: false + nameValidationError: false, + name: props.transmittedName }; } @@ -55,7 +56,7 @@ class BranchForm extends React.Component { }; render() { - const { t, branches, loading } = this.props; + const { t, branches, loading, transmittedName } = this.props; const { name } = this.state; orderBranches(branches); const options = branches.map(branch => ({ @@ -82,6 +83,7 @@ class BranchForm extends React.Component { value={name ? name : ""} validationError={this.state.nameValidationError} errorMessage={t("validation.branch.nameInvalid")} + disabled={!!transmittedName} /> diff --git a/scm-ui/src/repos/branches/containers/CreateBranch.js b/scm-ui/src/repos/branches/containers/CreateBranch.js index b801c98f1c..1b0ef76408 100644 --- a/scm-ui/src/repos/branches/containers/CreateBranch.js +++ b/scm-ui/src/repos/branches/containers/CreateBranch.js @@ -56,7 +56,7 @@ class CreateBranch extends React.Component { this.props.createBranch(branch, () => this.branchCreated(branch)); }; - matchesTransmittedName = (url: string) => { + transmittedName = (url: string) => { const params = queryString.parse(url); return params.name; }; @@ -68,7 +68,7 @@ class CreateBranch extends React.Component { return ; } - if (!branches) { + if (loading || !branches) { return ; } @@ -80,7 +80,7 @@ class CreateBranch extends React.Component { loading={loading} repository={repository} branches={branches} - transmittedName={this.matchesTransmittedName(location.search)} + transmittedName={this.transmittedName(location.search)} /> ); @@ -107,8 +107,7 @@ const mapDispatchToProps = dispatch => { const mapStateToProps = (state, ownProps) => { const { repository } = ownProps; - const loading = - isFetchBranchesPending(state, repository) || isCreateBranchPending(state); + const loading = isFetchBranchesPending(state, repository); //|| isCreateBranchPending(state); const error = getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state); const branches = getBranches(state, repository);