Show correct default branch in repository config (#1643)

This commit is contained in:
Eduard Heimbuch
2021-05-05 14:45:18 +02:00
committed by GitHub
parent b975fb655d
commit 7e3a6b6fb2
2 changed files with 8 additions and 4 deletions

View File

@@ -100,15 +100,17 @@ class RepositoryConfig extends React.Component<Props, State> {
apiClient
.get(configurationLink.href)
.then(response => response.json())
.then(payload =>
.then(payload => {
const defaultBranch =
payload.defaultBranch || this.state.branches?.filter((b: Branch) => b.defaultBranch)[0]?.name;
this.setState({
selectedBranchName: payload.defaultBranch,
selectedBranchName: defaultBranch,
nonFastForwardDisallowed: payload.nonFastForwardDisallowed,
disabled: !payload._links.update,
loadingDefaultBranch: false,
changed: false
})
)
});
})
.catch(error =>
this.setState({
error