Skip to content

Commit

Permalink
refactoring run of filterOutOwnRepos
Browse files Browse the repository at this point in the history
  • Loading branch information
fuoridallarete committed Jan 27, 2024
1 parent 10df217 commit 6162cb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/stats/[login].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Stats() {
const filterOutOwnRepos = (
repositories: PullRequestContributionsByRepository[]
) => {
return repositories.filter(
return repositories?.filter(
(repoData) => repoData.repository.owner.login !== session?.user.login
);
};
Expand All @@ -53,9 +53,11 @@ export default function Stats() {
}

const filteredReposBySearchQuery = filterReposBySearchQuery(repositories);
const filteredOutOwnRepos = filterOutOwnRepos(filteredReposBySearchQuery);
if (!hideOwnRepo) {
return filteredReposBySearchQuery;
}

return hideOwnRepo ? filteredOutOwnRepos : filteredReposBySearchQuery;
return filterOutOwnRepos(filteredReposBySearchQuery);
};

return filterRepos(repositories);
Expand Down

0 comments on commit 6162cb2

Please sign in to comment.