fix(topbar): handle GitHub API failure in getRepoStarCount#3483
fix(topbar): handle GitHub API failure in getRepoStarCount#3483Nithin0620 wants to merge 3 commits intoresend:canaryfrom
Conversation
|
|
@Nithin0620 is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 4/5
- This PR looks safe to merge with minimal risk: the reported issue is moderate (4/10) and limited to fallback behavior rather than a broad functional break.
- In
apps/web/src/components/topbar.tsx, returning the fallback in the revalidated fetch path could cache a transient GitHub outage as'—'for up to an hour, causing stale/misleading topbar data. - Pay close attention to
apps/web/src/components/topbar.tsx- revalidation fallback handling may persist temporary upstream failures longer than intended.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/web/src/components/topbar.tsx">
<violation number="1" location="apps/web/src/components/topbar.tsx:14">
P2: Returning the fallback inside a revalidated fetch path can cache a transient GitHub failure as `'—'` for up to an hour.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Auto-approved: Low-risk defensive error handling in a non-critical UI component (GitHub star count). No business logic, database, or security impact. Changes are isolated and straightforward.
What does this PR do?
Adds error handling to the
getRepoStarCountfunction intopbar.tsx.Previously, if the GitHub API was down, rate-limited, or returned an
unexpected response shape, the star count could display
NaNor causean unhandled error.
Changes
'—'fallback whenres.okis false (rate limit / downtime)undefined/NaNusingtypeofcheck instead of falsy checkBefore / After
Before: Star count shows
NaNor crashes when GitHub API failsAfter: Star count shows
—gracefully when GitHub API is unavailableChecklist
Summary by cubic
Handle GitHub API failures in the Topbar repo star count and avoid caching transient errors.
getRepoStarCountnow returns null for non-OK/invalid responses or parse failures, and the UI renders '—', preventing crashes or "NaN" while keeping the cache clean.Written for commit a7ca384. Summary will update on new commits.