Skip to content

Commit 6266aca

Browse files
authored
improve contributors sorting (#2304)
1 parent 924a13c commit 6266aca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

components/Package/RepositoryContributors.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ export default function RepositoryContributors({ fullName }: Props) {
3131

3232
const contributors: GitHubUser[] = useMemo(
3333
() =>
34-
data?.sort((a: GitHubUser, b: GitHubUser) => (a.contributions < b.contributions ? 1 : -1)),
34+
data?.sort((a: GitHubUser, b: GitHubUser) => {
35+
if (a.contributions === b.contributions) {
36+
return a.login.localeCompare(b.login);
37+
}
38+
return a.contributions < b.contributions ? 1 : -1;
39+
}),
3540
[data]
3641
);
3742

0 commit comments

Comments
 (0)