Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/pages/Tracker/Tracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const Home: React.FC = () => {
setUsername,
token,
setToken,
error: authError,
getOctokit,
} = useGitHubAuth();

Expand Down Expand Up @@ -324,9 +323,9 @@ const Home: React.FC = () => {
</FormControl>
</Box>

{(authError || dataError) && (
{dataError && (
<Alert severity="error" sx={{ mb: 3 }}>
{authError || dataError}
{dataError}
</Alert>
)}
Comment on lines +326 to 330
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 1) Confirm useGitHubAuth does NOT expose an `error` field (justifies the removal)
fd -t f 'useGitHubAuth.ts' --exec cat {}

# 2) Inspect useGitHubData: does it set `error` on 401/auth failures? Does fetchData
#    handle a null octokit (missing token) without silently returning?
fd -t f 'useGitHubData.ts' --exec cat {}

Repository: GitMetricsLab/github_tracker

Length of output: 6446


Tracker alert wiring: auth failures now reach dataError, but messaging is still generic

  • useGitHubAuth doesn’t return an error field, so removing the unused authError destructure is valid.
  • useGitHubData.fetchData will surface auth failures to the Alert via setError(...) when any octokit.request promise rejects (Promise.allSettledhasRejected), so #625’s “show an alert” intent should work.
  • The more specific 401/permission messages in useGitHubData’s catch likely won’t run because request failures are handled by allSettled; consider extracting rejected reasons and mapping them to auth-specific messages to fully satisfy #625.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/Tracker/Tracker.tsx` around lines 326 - 330, The Alert currently
shows a generic dataError because useGitHubData.fetchData uses
Promise.allSettled and only sets a generic error when hasRejected is true;
update fetchData to inspect the settled results (the rejected reasons) from
Promise.allSettled, extract HTTP status or Octokit error identifiers (e.g.,
401/permissions), map those to specific auth messages, and call setError(...)
with the mapped message so dataError (rendered in Tracker.tsx) shows
auth-specific text; also confirm useGitHubAuth no longer destructures authError
and that setError is used instead of any removed authError variable.


Expand Down
Loading