Skip to content

Conversation

@Abhay056
Copy link

@Abhay056 Abhay056 commented Aug 8, 2025

Related Issue


Details of Fix

  • To fix the issue, passed the filter state to the API query itself.
  • This way, we ask the API directly for "10 merged pull requests," ensuring each page is full.
  • Removed the state-based filtering, as the API will now handle it.

Type of Change

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

Summary by CodeRabbit

  • New Features
    • Enhanced filtering options for issues and pull requests, allowing users to filter by state (such as open, closed, merged) directly via the interface.
  • Improvements
    • Improved accuracy and responsiveness of data fetching when navigating between tabs or changing filters.
    • More reliable display and pagination of issues and pull requests.
  • Bug Fixes
    • Resolved redundant data fetching on initial page load.
  • Chores
    • Updated internal dependencies for improved GitHub API support.

@netlify
Copy link

netlify bot commented Aug 8, 2025

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit bcaf9ee
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/689626f5de4c890008327c47
😎 Deploy Preview https://deploy-preview-181--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
Contributor

coderabbitai bot commented Aug 8, 2025

Walkthrough

The changes update the GitHub data fetching logic by switching to the @octokit/rest client, improving type safety, and enhancing the filtering and pagination of issues and pull requests. The Tracker page's data flow is refined to better handle API-based filtering, and redundant client-side filtering is reduced. Dependency updates are also included.

Changes

Cohort / File(s) Change Summary
Dependency Update
package.json
Added @octokit/rest as a new dependency.
Octokit Integration
src/hooks/useGitHubAuth.ts
Switched Octokit import from @octokit/core to @octokit/rest. Updated memoization and instance creation to depend only on the token.
GitHub Data Hook Refactor
src/hooks/useGitHubData.ts
Enhanced type safety using Octokit types, removed fetchPaginated helper, integrated logic into fetchData, improved query flexibility, and updated error handling.
Tracker Page Data Flow
src/pages/Tracker/Tracker.tsx
Refactored data fetching to avoid redundant calls, integrated filter parameters into API requests, removed state-based client-side filtering, and updated table rendering and pagination logic.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TrackerPage
  participant useGitHubAuth
  participant useGitHubData
  participant OctokitAPI

  User->>TrackerPage: Changes tab/filter/page or submits form
  TrackerPage->>useGitHubAuth: Get Octokit instance
  TrackerPage->>useGitHubData: fetchData(username, page, perPage, type, state)
  useGitHubData->>OctokitAPI: Search issues/PRs with filters
  OctokitAPI-->>useGitHubData: Return filtered results
  useGitHubData-->>TrackerPage: Update issues/PRs state
  TrackerPage-->>User: Render updated table
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix bug: After selecting merged filter for PR, first page shows less than 10 entries (#174)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Suggested labels

gssoc25, level2

Suggested reviewers

  • mehul-m-prajapati

Poem

A bunny hopped through code so bright,
With Octokit’s REST now set just right.
Filters fixed and data flows anew,
PRs and issues—counted true!
No more merged-page bug in sight,
This patch brings users pure delight.
🐇✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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 @Abhay056 for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

Copy link
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

🧹 Nitpick comments (3)
src/hooks/useGitHubAuth.ts (1)

11-14: Trim the token before instantiating Octokit

If the user pastes a PAT with a trailing space / newline, authentication silently fails. A one-liner avoids that:

-  return new Octokit({ auth: token });
+  return new Octokit({ auth: token.trim() });
src/hooks/useGitHubData.ts (1)

33-43: Use is: instead of state: for open/closed to match GitHub search qualifiers

While state:open sometimes works, the documented qualifier is is:open / is:closed. Safer string building:

-          query += state === 'merged' ? ` is:merged` : ` state:${state}`;
+          query += state === 'merged'
+            ? ' is:merged'
+            : ` is:${state}`;

This avoids query-syntax regressions if GitHub tightens parsing.

src/pages/Tracker/Tracker.tsx (1)

289-310: Minor CPU win: memoise filteredData for large result sets

filterData runs on every render; with title/date filters it can re-scan up to 100 items/time. Wrap in useMemo keyed on [currentRawData, searchTitle, selectedRepo, startDate, endDate] to avoid redundant work.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 988166d and bcaf9ee.

📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/hooks/useGitHubAuth.ts (2 hunks)
  • src/hooks/useGitHubData.ts (2 hunks)
  • src/pages/Tracker/Tracker.tsx (10 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/pages/Tracker/Tracker.tsx (2)
src/hooks/useGitHubData.ts (1)
  • GitHubItem (7-7)
src/pages/ContributorProfile/ContributorProfile.tsx (1)
  • ContributorProfile (11-95)
🔇 Additional comments (1)
src/pages/Tracker/Tracker.tsx (1)

73-90: Missing dependencies will violate React-hook exhaustive-deps rule

fetchData and username are referenced inside this useEffect but omitted from the dependency array. ESLint’s react-hooks/exhaustive-deps will flag this and, more importantly, username changes won’t trigger a refetch unless the user resubmits the form.

-  }, [page, tab, issueFilter, prFilter]);
+  }, [page, tab, issueFilter, prFilter, username, fetchData]);

If you intentionally excluded them, add an inline // eslint-disable-next-line react-hooks/exhaustive-deps with a rationale.

"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.6",
"@mui/material": "^5.15.6",
"@octokit/rest": "^22.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove redundant Octokit packages to avoid version drift

With @octokit/rest added, the existing "octokit" meta-package (Line 25) is now redundant and may pull in a different, transitive @octokit/rest version. Keeping both can bloat install size and introduce subtle mismatches.

Either drop "octokit" or justify why both are required; keeping only one source of the REST client is the safer default.

🤖 Prompt for AI Agents
In package.json at line 19, the dependency "@octokit/rest" is added while the
"octokit" meta-package is also present at line 25, causing redundancy and
potential version conflicts. Remove the "octokit" package from the dependencies
to avoid pulling in multiple versions of the REST client and reduce install
size, unless there is a specific reason to keep both.

@Abhay056 Abhay056 closed this by deleting the head repository Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: After selecting merged filter for PR, first page shows less than 10 entries.

1 participant