fix issue with array index out of bounds when accessing linkedConnections

This commit is contained in:
bkellam 2025-04-01 12:02:06 -07:00
parent f8ac8b62a2
commit 0bb47cdc50
2 changed files with 16 additions and 11 deletions

View file

@ -95,6 +95,7 @@ export const ErrorNavIndicator = () => {
<div className="flex flex-col gap-2">
{repos
.slice(0, 10)
.filter(item => item.linkedConnections.length > 0) // edge case: don't show repos that are orphaned and awaiting gc.
.map(repo => (
// Link to the first connection for the repo
<Link key={repo.repoId} href={`/${domain}/connections/${repo.linkedConnections[0].id}`} onClick={() => captureEvent('wa_error_nav_job_pressed', {})}>

View file

@ -48,7 +48,10 @@ export const ProgressNavIndicator = () => {
The following repositories are currently being indexed:
</p>
<div className="flex flex-col gap-2 pl-4">
{inProgressRepos.slice(0, 10).map(item => (
{
inProgressRepos.slice(0, 10)
.filter(item => item.linkedConnections.length > 0) // edge case: don't show repos that are orphaned and awaiting gc.
.map(item => (
// Link to the first connection for the repo
<Link key={item.repoId} href={`/${domain}/connections/${item.linkedConnections[0].id}`} onClick={() => captureEvent('wa_progress_nav_job_pressed', {})}>
<div className="flex items-center gap-2 px-3 py-2 bg-green-50 dark:bg-green-900/20
@ -58,7 +61,8 @@ export const ProgressNavIndicator = () => {
<span className="font-medium truncate">{item.repoName}</span>
</div>
</Link>
))}
)
)}
{inProgressRepos.length > 10 && (
<div className="text-sm text-green-600/90 dark:text-green-300/90 pl-3 pt-1">
And {inProgressRepos.length - 10} more...