From 05cd0b0d3d6a5d1f127ad540843ca84a7d200a29 Mon Sep 17 00:00:00 2001 From: Damanpreet Singh Date: Wed, 14 Oct 2020 13:38:42 +0530 Subject: [PATCH] #652 select the default branch as source (#805) * set source branch to default_branch * Replaced masterBranch with defaultBranch to maintain terminology * linter fix for BranchesPage --- webui/src/components/BranchesPage.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webui/src/components/BranchesPage.js b/webui/src/components/BranchesPage.js index 1ca8c1f351b..3717015ed03 100644 --- a/webui/src/components/BranchesPage.js +++ b/webui/src/components/BranchesPage.js @@ -26,7 +26,8 @@ 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); @@ -34,7 +35,7 @@ const CreateBranchButton = connect( const onHide = () => { if (disabled) return; setShow(false); - setSelectedBranch(null); + setSelectedBranch(defaultBranch); }; const onSubmit = () => { @@ -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 ( <>