From e6912ef77b2ec1c854caf4a9794ee2d12c1bc2a3 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Fri, 29 Mar 2019 14:54:18 +0100 Subject: [PATCH] fixed preloading bug for sorting null branches --- scm-ui/src/repos/branches/components/BranchRow.js | 8 ++++++-- .../src/repos/branches/containers/BranchesOverview.js | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scm-ui/src/repos/branches/components/BranchRow.js b/scm-ui/src/repos/branches/components/BranchRow.js index 411eb383a3..873bc066c7 100644 --- a/scm-ui/src/repos/branches/components/BranchRow.js +++ b/scm-ui/src/repos/branches/components/BranchRow.js @@ -11,10 +11,14 @@ type Props = { export default class BranchRow extends React.Component { renderLink(to: string, label: string, defaultBranch: boolean) { let showLabel = null; - if(defaultBranch) { + if (defaultBranch) { showLabel = Default; } - return {label} {showLabel}; + return ( + + {label} {showLabel} + + ); } render() { diff --git a/scm-ui/src/repos/branches/containers/BranchesOverview.js b/scm-ui/src/repos/branches/containers/BranchesOverview.js index 71e8452fdb..b39c821494 100644 --- a/scm-ui/src/repos/branches/containers/BranchesOverview.js +++ b/scm-ui/src/repos/branches/containers/BranchesOverview.js @@ -40,9 +40,9 @@ type Props = { // followed by develop the rest should be ordered by its name export function orderBranches(branches: Branch[]) { branches.sort((a, b) => { - if (a.defaultBranch && !b.defaultBranch ) { + if (a.defaultBranch && !b.defaultBranch) { return -20; - } else if (!a.defaultBranch && b.defaultBranch ) { + } else if (!a.defaultBranch && b.defaultBranch) { return 20; } else if (a.name === "master" && b.name !== "master") { return -10; @@ -74,16 +74,16 @@ class BranchesOverview extends React.Component { render() { const { baseUrl, loading, error, branches, t } = this.props; - orderBranches(branches); - if (error) { return ; } - if (loading) { + if (!branches || loading) { return ; } + orderBranches(branches); + return ( <>