-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
APIgood first issueGood for newcomersGood for newcomershacktoberfestRelated to HacktoberfestRelated to Hacktoberfest
Description
The language distribution calculation for pinned repositories is not working as expected. When trying to get the language distribution for pinned repos, the result is an empty array.
Example of the issue:
const { getRepositories } = useGitHub({ username: 'octocat' });
// Works correctly
console.log(getRepositories().all().languageDistribution());
// Output: [{ language: 'javascript', percentage: 0.5 }, { language: 'python', percentage: 0.5 }]
// Returns an empty array
console.log(getRepositories().pinned().languageDistribution());
// Output: []Possible cause: The GraphQL query for pinned repos only fetches primaryLanguage, but the calculateLanguageDistribution function expects a language property.
Possible fix can be something like,
const pinnedRepos = response.data.data.user.pinnedItems.nodes.map(
(repo: any) => ({
// ... other properties ...
language: repo.primaryLanguage
? repo.primaryLanguage.name.toLowerCase()
: null,
}),
);This change should make the pinned repos data structure compatible with the language distribution function.
Metadata
Metadata
Assignees
Labels
APIgood first issueGood for newcomersGood for newcomershacktoberfestRelated to HacktoberfestRelated to Hacktoberfest