Set default branch in branch selector if nothing is selected

This commit is contained in:
Florian Scholdei
2020-09-21 09:58:49 +02:00
parent dcc2c45dad
commit a1ea6ea62e
3 changed files with 7 additions and 6 deletions

View File

@@ -102,7 +102,7 @@ const ContributorDetails = styled.div`
const ContributorToggleLine = styled.p`
cursor: pointer;
/** maring-bottom is inherit from content p **/
/** margin-bottom is inherit from content p **/
margin-bottom: 0.5rem !important;
`;

View File

@@ -76,12 +76,13 @@ class ChangesetsRoot extends React.Component<Props> {
}
const url = this.stripEndingSlash(match.url);
const defaultBranch = branches?.filter(b => b.defaultBranch === true)[0];
return (
<>
<CodeActionBar
branches={branches}
selectedBranch={!this.isBranchAvailable() ? selectedBranch : undefined}
selectedBranch={!this.isBranchAvailable() ? selectedBranch : defaultBranch?.name}
onSelectBranch={this.onSelectBranch}
switchViewLink={this.evaluateSwitchViewLink()}
/>