Skip to content

fix(avatars): robust avatar resolution for miners using numeric IDs#1005

Open
watcharaponthod-code wants to merge 5 commits intoentrius:testfrom
watcharaponthod-code:test
Open

fix(avatars): robust avatar resolution for miners using numeric IDs#1005
watcharaponthod-code wants to merge 5 commits intoentrius:testfrom
watcharaponthod-code:test

Conversation

@watcharaponthod-code
Copy link
Copy Markdown

Summary

This PR fixes a bug where avatars fail to load in the leaderboard and miner lists when a miner's author name (username) is missing and the system falls back to their numeric githubId.

Previously, the system would attempt to fetch the avatar from github.com/{id}.png, which returns a 404 for numeric IDs. I have refactored the avatar utility to automatically detect numeric identifiers and use the correct avatars.githubusercontent.com/u/{id} endpoint.

Changes

  • Utility Refactor (src/utils/avatar.ts): Added getGithubAvatarSrc, a robust resolver that handles both usernames and numeric IDs with auto-detection logic.
  • Global Update (src/utils/ExplorerUtils.ts): Re-exported the robust utility to ensure all callers benefit from the fix.
  • Leaderboard Fix (LeaderboardSidebar.tsx, MinerCard.tsx, MinersList.tsx): Updated call sites to pass both author and githubId, providing the resolver with the best available data.

Verification

  • Verified that numeric strings (e.g., "240883001") now resolve to https://avatars.githubusercontent.com/u/240883001 instead of https://github.com/240883001.png.
  • Verified that alphabetic usernames still resolve to the standard github.com/{user}.png URL.
  • Ensured no regressions in other components using the shared utility.

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant