fix(www): guard github/discord counters against invalid API responses#902
Merged
Yeom-JinHo merged 2 commits intomagicuidesign:mainfrom Mar 2, 2026
Merged
Conversation
|
@Yeom-JinHo is attempting to deploy a commit to the product-studio Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
This PR updates the social counter components in
wwwto prevent runtime failures when external API responses are invalid or unavailable.It adds defensive parsing and fallback handling for both GitHub stars and Discord online member counts.
Changes
formatCompactCount) in:apps/www/components/github-link.tsxapps/www/components/discord-link.tsxgetStarsCount()with guards:0whenfetchfails0when response is notok0when payload shape is invalid (stargazers_countmissing/non-numeric)getActiveMembersCount()with guards:0whenfetchfails0when response is notok0when payload shape is invalid (presence_countmissing/non-numeric)Motivation
toLocaleString()calls on undefined values can crash prerender/build.Breaking Changes