diff --git a/scm-ui/src/repos/branches/modules/branches.js b/scm-ui/src/repos/branches/modules/branches.js index 7f8c45932a..0efabcc90c 100644 --- a/scm-ui/src/repos/branches/modules/branches.js +++ b/scm-ui/src/repos/branches/modules/branches.js @@ -304,17 +304,22 @@ const reduceByBranchesSuccess = (state, payload) => { const byName = repoState.byName || {}; repoState.byName = byName; - const branches = response._embedded.branches; - const names = branches.map(b => b.name); - response._embedded.branches = names; - for (let branch of branches) { - byName[branch.name] = branch; + if(response._embedded) { + const branches = response._embedded.branches; + const names = branches.map(b => b.name); + response._embedded.branches = names; + for (let branch of branches) { + byName[branch.name] = branch; + } + return { + [key]: { + list: response, + byName + } + }; } return { - [key]: { - list: response, - byName - } + [key]: [] }; }; diff --git a/scm-ui/src/repos/containers/ChangesetsRoot.js b/scm-ui/src/repos/containers/ChangesetsRoot.js index c4c310d94d..8e0b44afbe 100644 --- a/scm-ui/src/repos/containers/ChangesetsRoot.js +++ b/scm-ui/src/repos/containers/ChangesetsRoot.js @@ -80,19 +80,17 @@ class ChangesetsRoot extends React.Component { return ; } - if (!repository || !branches) { + if (!repository) { return null; } const url = this.stripEndingSlash(match.url); - const branch = this.findSelectedBranch(); + const branch = branches ? this.findSelectedBranch() : null; const changesets = ; return (
-
{this.renderBranchSelector()} -
changesets} />
); @@ -102,14 +100,16 @@ class ChangesetsRoot extends React.Component { const { repository, branches, selected, t } = this.props; if (repository._links.branches) { return ( - { - this.branchSelected(b); - }} - /> +
+ { + this.branchSelected(b); + }} + /> +
); } return null; diff --git a/scm-ui/src/repos/sources/containers/Sources.js b/scm-ui/src/repos/sources/containers/Sources.js index 2d7e1ca468..5cbf66c032 100644 --- a/scm-ui/src/repos/sources/containers/Sources.js +++ b/scm-ui/src/repos/sources/containers/Sources.js @@ -94,7 +94,7 @@ class Sources extends React.Component { if (currentFileIsDirectory) { return (
-
{this.renderBranchSelector()}
+ {this.renderBranchSelector()} { if (branches) { return ( - { - this.branchSelected(b); - }} - /> +
+ { + this.branchSelected(b); + }} + /> +
); } return null;