fix(avatars): robust avatar resolution for miners using numeric IDs#1005
Open
watcharaponthod-code wants to merge 5 commits intoentrius:testfrom
Open
fix(avatars): robust avatar resolution for miners using numeric IDs#1005watcharaponthod-code wants to merge 5 commits intoentrius:testfrom
watcharaponthod-code wants to merge 5 commits intoentrius:testfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 correctavatars.githubusercontent.com/u/{id}endpoint.Changes
src/utils/avatar.ts): AddedgetGithubAvatarSrc, a robust resolver that handles both usernames and numeric IDs with auto-detection logic.src/utils/ExplorerUtils.ts): Re-exported the robust utility to ensure all callers benefit from the fix.LeaderboardSidebar.tsx,MinerCard.tsx,MinersList.tsx): Updated call sites to pass bothauthorandgithubId, providing the resolver with the best available data.Verification
https://avatars.githubusercontent.com/u/240883001instead ofhttps://github.com/240883001.png.github.com/{user}.pngURL.