Skip to content

Commit

Permalink
#652 select the default branch as source (#805)
Browse files Browse the repository at this point in the history
* set source branch to default_branch

* Replaced masterBranch with defaultBranch to maintain terminology

* linter fix for BranchesPage
  • Loading branch information
fumblehool committed Oct 14, 2020
1 parent 6763612 commit 05cd0b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions webui/src/components/BranchesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ const CreateBranchButton = connect(
({ createBranch, resetBranch })
)(({ repo, status, createBranch, resetBranch }) => {
const [show, setShow] = useState(false);
const [selectedBranch, setSelectedBranch] = useState(null);
const defaultBranch = { id: repo.default_branch, type: "branch"};
const [selectedBranch, setSelectedBranch] = useState(defaultBranch);
const textRef = useRef(null);

const disabled = (status.inProgress);

const onHide = () => {
if (disabled) return;
setShow(false);
setSelectedBranch(null);
setSelectedBranch(defaultBranch);
};

const onSubmit = () => {
Expand All @@ -45,10 +46,10 @@ const CreateBranchButton = connect(
useEffect(() => {
if (status.done) {
setShow(false);
setSelectedBranch(null);
setSelectedBranch(defaultBranch);
resetBranch();
}
}, [resetBranch, status.done]);
}, [resetBranch, status.done, defaultBranch]);

return (
<>
Expand Down

0 comments on commit 05cd0b0

Please sign in to comment.