handle error case

pull/5000/head
Joseph Izang 5 months ago committed by Aniket
parent 1c4af68ab1
commit bed41f3b07
  1. 3
      libs/remix-ui/git/src/components/branchHeader.tsx

@ -59,6 +59,7 @@ export const BranchHeader = () => {
const getName = () => {
const url = context.currentBranch?.remote?.url
if (!url) return
const regex = /https:\/\/github\.com\/[^/]+\/([^/]+)\.git/
const match = url.match(regex)
return match ? match[1] : 'Couldn\'t get repo name!'
@ -80,7 +81,7 @@ export const BranchHeader = () => {
<span className="">Repository Name:</span>
<span className="text-secondary text-truncate overflow-hidden whitespace-nowrap" style={{ width: '15rem' }}>
<span className={`${ changed ? 'text-danger pl-2' : "pl-2" }`}>
{getName()}
{getName() ?? ''}
</span>
</span>
</div>

Loading…
Cancel
Save