fix: [CODE-3363] backfill author data in filter on reload and navigating back to PR listing page (#3595)

* fix: [CODE-3363] lint
* fix: [CODE-3363] use identifer to re-render
* fix: [CODE-3363] backfill author data in filter on reload and navigating back to PR listing page
main
Ritik Kapoor 2025-03-28 12:06:37 +00:00 committed by Harness
parent d79d292d87
commit 1ffe29d15a
2 changed files with 12 additions and 3 deletions

View File

@ -504,10 +504,10 @@ repoEmptyMarkdownExisting: |
webhookEmpty: There are no webhooks in your repo. Click the button below to create a webhook.
compareEmptyDiffTitle: There isn't anything to compare
compareEmptyDiffMessage: Two branches are identical.
noCommits: There is no commits
noCommits: There are no commits
noCommitsMessage: This repository does not have any commits yet.
noCommitsPR: This Pull Request does not have commit history.
noChanges: There is no changes
noChanges: There are no changes
noChangesPR: This Pull Request does not have any changes.
noChangesCompare: Source and target are identical.
pageLoading: Loading, please wait...

View File

@ -96,7 +96,15 @@ export function PRAuthorFilter({
}
)
const authors = [...fetchedAuthors, ...(activePullRequestAuthorObj ? [activePullRequestAuthorObj] : [])]
const authors = [...fetchedAuthors]
if (activePullRequestAuthorObj?.id) {
// Only add activePullRequestAuthorObj if it exists and isn't already in the list
const isDuplicate = fetchedAuthors.some(author => author.id === activePullRequestAuthorObj.id)
if (!isDuplicate) {
authors.push(activePullRequestAuthorObj)
}
}
const authorsList = await moveCurrentUserToTop(authors, currentUser, query)
@ -118,6 +126,7 @@ export function PRAuthorFilter({
return (
<DropDown
key={activePullRequestAuthorObj?.id}
value={authorFilterOption}
items={() => getAuthorsPromise()}
disabled={loadingAuthors}