Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix the rate limit exceed of GitHub API on contributors page #1423

Closed
4 tasks done
ThePhoenix08 opened this issue Dec 23, 2024 · 3 comments · Fixed by #1426
Closed
4 tasks done

[Bug] Fix the rate limit exceed of GitHub API on contributors page #1423

ThePhoenix08 opened this issue Dec 23, 2024 · 3 comments · Fixed by #1426
Assignees
Labels
bug 🐞 Something isn't working enhancement ✨ New feature or request Hard Complex or challenging task KWOC KWOC Open Source Program style tweak 🎨 Improve the website style or formatting

Comments

@ThePhoenix08
Copy link
Contributor

ThePhoenix08 commented Dec 23, 2024

Description

Rate Limit of GitHub API is getting exceeded while loading individual avatars and names of the contributors on the contributors page of the application.
I diagnosed this in my local testing is being caused by following lines

...
fetch(contributor.url)
 .then(contributorDetails => contributorDetails.json())
 .then(contributorData => {
     const displayName = contributorData.name || contributor.login;
...

As we can see, for each contributor specific contributor data is being fetched and loaded as contributorData but all it is being used as in the document is for the display name of the individual. Large amounts of fetch requests and rate limiting error issue can be avoided by not fetching this contributor.url for just the "name" of the contributor and instead using the already in use as fallback contributor.login that is the username as display name for all users. Either way the rate limit results in most of the contributors display names being fallback to username only.

So I propose the following improvements

  • Remove the contributor.url fetch and use contributor.login as username
  • Implement lazy loading for avatars of the contributors
  • Introduce an avatar fallback icon / svg if avatar fetch fails or is loading
  • Implement infinite scroll functionality so that number of queries can be further reduced. Infinite scroll methodology will only fetch further contributors on scroll to fill the viewport.
  • Add contributions count bubble on avatars top right corner which show how many contributions they did to the repo, its available in the data we fetch but is not in use.

Screenshots

Developer tools > Network tab:
Screenshot 2024-12-23 121801

Developer tools > Console
Screenshot 2024-12-23 121746

Checklist

  • I have checked the existing issues.
  • I follow Contributing Guidelines of this project.
  • I am a KWOC'24 contributor.

Code of Conduct

Copy link

Hey @ThePhoenix08, Welcome to the project Beautiify! 🎊
Thanks for opening an issue! 🙌 Please wait for the issue to be assigned. Happy Coding!! ✨

@Rakesh9100
Copy link
Owner

Please go ahead @ThePhoenix08

@Rakesh9100 Rakesh9100 added the KWOC KWOC Open Source Program label Dec 23, 2024
@Rakesh9100 Rakesh9100 changed the title [Bug] Rate Limit of Github API exceeded on contributors page [Bug] Fix the rate limit exceed of GitHub API on contributors page Dec 28, 2024
Copy link

Hello @ThePhoenix08! Your issue #1423 has been closed. Thank you for your contribution!! 🙌

@Rakesh9100 Rakesh9100 added enhancement ✨ New feature or request Hard Complex or challenging task style tweak 🎨 Improve the website style or formatting bug 🐞 Something isn't working labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working enhancement ✨ New feature or request Hard Complex or challenging task KWOC KWOC Open Source Program style tweak 🎨 Improve the website style or formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants