Skip to content

Added summary block#666

Open
Pari658 wants to merge 1 commit into
GitMetricsLab:mainfrom
Pari658:AddedSummary
Open

Added summary block#666
Pari658 wants to merge 1 commit into
GitMetricsLab:mainfrom
Pari658:AddedSummary

Conversation

@Pari658
Copy link
Copy Markdown

@Pari658 Pari658 commented Jun 1, 2026

Related Issue


Description

Added a Developer Summary section to the Tracker page that displays GitHub profile insights based on the entered username.

Changes Made

  • Created a new DeveloperSummary component.

  • Fetched GitHub user profile information using the GitHub API.

  • Displayed key profile details including:

    • Profile avatar
    • Name
    • Bio
    • Public repositories count
    • Followers and following count
  • Integrated the Developer Summary card into the Tracker page.

  • Added responsive styling using Material UI components.


How Has This Been Tested?

  • Ran the application locally using npm run dev.
  • Tested with multiple GitHub usernames.
  • Verified that profile information loads correctly and updates based on the entered username.
  • Confirmed that existing tracker functionality remains unaffected.

Screenshots

image

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features
    • Added a developer profile summary card on the tracker page that displays GitHub user information, including avatar, name, bio, public repository count, followers, and following statistics.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 5e214c5
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1d6a030842110008b5e643
😎 Deploy Preview https://deploy-preview-666--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a new DeveloperSummary React component that fetches and displays GitHub user profile information using the public GitHub API. The component is integrated into the Tracker page to show developer summaries alongside existing tracker functionality.

Changes

Developer Summary Feature

Layer / File(s) Summary
DeveloperSummary component with GitHub API fetch
src/components/DeveloperSummary.tsx
New React functional component typed with { username: string } props; fetches GitHub user profile via api.github.com/users/{username} in a useEffect hook; stores fetched profile in state; renders Material UI Paper card displaying avatar, name, bio, and stat chips for public repositories, followers, and following counts; returns null during loading and logs API/parse errors.
Tracker page integration
src/pages/Tracker/Tracker.tsx
Imports DeveloperSummary and renders it in the tracker page, passing the current username prop to display the profile summary.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#490: Refactor of Tracker.tsx to derive username from UserContext after login, which sets up the foundation for passing username to the new DeveloperSummary component.

Suggested labels

level:intermediate, quality:clean, type:feature

Poem

🐰 A developer's story, now told with care,
GitHub profiles summoned from the air,
Avatars dancing, stats on display,
Usernames fetching profiles bright as day!
Summary cards to light the Tracker's way! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Added summary block' is vague and generic, using non-descriptive phrasing that doesn't clearly convey what was added or its purpose. Revise the title to be more specific, such as 'Add Developer Summary component to display GitHub profile insights' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description follows the required template with all major sections completed: Related Issue, Description with detailed changes, testing methodology, screenshots, and Type of Change selection.
Linked Issues check ✅ Passed The PR successfully implements all objectives from issue #664: fetching GitHub profile details by username, retrieving repository statistics and counts, and presenting key insights in a structured card component.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #664 objectives; the new DeveloperSummary component and its integration into Tracker.tsx are within scope and address the feature requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @Pari658 for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with 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.

Inline comments:
In `@src/components/DeveloperSummary.tsx`:
- Around line 27-34: The fetch in the useEffect (triggered by username) calls
res.json() unconditionally and passes that result to setProfile, causing error
payloads (e.g. {"message":"Not Found"}) to be treated as a valid profile; update
the fetch chain to check res.ok before setting state: after fetch, inspect
res.ok and if false extract the error message (e.g. await res.json() or
res.text()) and handle it (throw or set an error state) so setProfile only
receives a successful user object; modify the useEffect/fetch block that
references username and setProfile to guard non-OK responses and avoid rendering
error objects as profile data.
- Around line 27-34: The effect in DeveloperSummary (the useEffect that reads
username and calls fetch and setProfile) runs on every keystroke, causes
unauthenticated rate-limit issues, can suffer raced responses, and never clears
stale profile; update it to debounce/defer requests and abort in-flight fetches:
create an AbortController inside the effect and call controller.abort in the
cleanup, start the fetch only after a short debounce timeout (clear the timeout
in cleanup), clear profile immediately when username becomes empty or when
starting a new request, and accept an optional token prop from Tracker to
include an Authorization header for authenticated requests; reference the
useEffect, username, setProfile, and fetch call when making these changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21fdd4b1-15b8-4c60-9c93-cc9f723754f0

📥 Commits

Reviewing files that changed from the base of the PR and between 53f820b and 5e214c5.

📒 Files selected for processing (2)
  • src/components/DeveloperSummary.tsx
  • src/pages/Tracker/Tracker.tsx

Comment on lines +27 to +34
useEffect(() => {
if (!username) return;

fetch(`https://api.github.com/users/${username}`)
.then((res) => res.json())
.then((data) => setProfile(data))
.catch(console.error);
}, [username]);
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 | 🟠 Major | ⚡ Quick win

Error responses are stored and rendered as profile data.

res.json() is called unconditionally, but the GitHub API returns a JSON body even for failures (e.g. {"message":"Not Found"} on 404, or rate-limit/403). That error object is then passed to setProfile, so the card renders with profile.public_repos etc. as undefined — e.g. "undefined public repositories and undefined followers". Check res.ok before storing.

🛡️ Proposed fix to guard non-OK responses
     fetch(`https://api.github.com/users/${username}`)
-      .then((res) => res.json())
+      .then((res) => {
+        if (!res.ok) throw new Error(`GitHub API error: ${res.status}`);
+        return res.json();
+      })
       .then((data) => setProfile(data))
       .catch(console.error);
🤖 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/components/DeveloperSummary.tsx` around lines 27 - 34, The fetch in the
useEffect (triggered by username) calls res.json() unconditionally and passes
that result to setProfile, causing error payloads (e.g. {"message":"Not Found"})
to be treated as a valid profile; update the fetch chain to check res.ok before
setting state: after fetch, inspect res.ok and if false extract the error
message (e.g. await res.json() or res.text()) and handle it (throw or set an
error state) so setProfile only receives a successful user object; modify the
useEffect/fetch block that references username and setProfile to guard non-OK
responses and avoid rendering error objects as profile data.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fetch fires on every keystroke and is subject to a race condition.

In Tracker.tsx the username prop is bound directly to the input's onChange (live value), so this effect runs on every keystroke. Each run issues an unauthenticated GitHub request, which quickly exhausts the 60 requests/hour anonymous limit. Additionally, with no cleanup/abort, responses can resolve out of order and overwrite newer state, and the previous profile is never cleared when username changes (stale card shown for the new name).

Consider debouncing and aborting in-flight requests. If you also pass the existing token from the Tracker, requests would be authenticated and far less rate-limited.

♻️ Proposed debounce + abort
   useEffect(() => {
     if (!username) return;
 
-    fetch(`https://api.github.com/users/${username}`)
-      .then((res) => res.json())
-      .then((data) => setProfile(data))
-      .catch(console.error);
-  }, [username]);
+    const controller = new AbortController();
+    const timer = setTimeout(() => {
+      fetch(`https://api.github.com/users/${username}`, {
+        signal: controller.signal,
+      })
+        .then((res) => {
+          if (!res.ok) throw new Error(`GitHub API error: ${res.status}`);
+          return res.json();
+        })
+        .then((data) => setProfile(data))
+        .catch((err) => {
+          if (err.name !== "AbortError") console.error(err);
+        });
+    }, 500);
+
+    return () => {
+      clearTimeout(timer);
+      controller.abort();
+    };
+  }, [username]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
if (!username) return;
fetch(`https://api.github.com/users/${username}`)
.then((res) => res.json())
.then((data) => setProfile(data))
.catch(console.error);
}, [username]);
useEffect(() => {
if (!username) return;
const controller = new AbortController();
const timer = setTimeout(() => {
fetch(`https://api.github.com/users/${username}`, {
signal: controller.signal,
})
.then((res) => {
if (!res.ok) throw new Error(`GitHub API error: ${res.status}`);
return res.json();
})
.then((data) => setProfile(data))
.catch((err) => {
if (err.name !== "AbortError") console.error(err);
});
}, 500);
return () => {
clearTimeout(timer);
controller.abort();
};
}, [username]);
🤖 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/components/DeveloperSummary.tsx` around lines 27 - 34, The effect in
DeveloperSummary (the useEffect that reads username and calls fetch and
setProfile) runs on every keystroke, causes unauthenticated rate-limit issues,
can suffer raced responses, and never clears stale profile; update it to
debounce/defer requests and abort in-flight fetches: create an AbortController
inside the effect and call controller.abort in the cleanup, start the fetch only
after a short debounce timeout (clear the timeout in cleanup), clear profile
immediately when username becomes empty or when starting a new request, and
accept an optional token prop from Tracker to include an Authorization header
for authenticated requests; reference the useEffect, username, setProfile, and
fetch call when making these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Generate Developer Summary from GitHub Profile

1 participant