Skip to content

Conversation

@Srijatalamarla
Copy link
Contributor

@Srijatalamarla Srijatalamarla commented Aug 28, 2025

Related Issue


Description

Updated the pull request filtering logic to ensure that closed only includes PRs that are closed but not merged,
and merged only includes PRs that have been merged.


Screenshots

  • Before fix:
Screenshot 2025-08-29 002426
  • After fix:
Screenshot 2025-08-29 002503 Screenshot 2025-08-29 002706

Type of Change

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

Summary by CodeRabbit

  • Bug Fixes
    • Corrected Tracker filters to treat Open, Closed, and Merged as distinct categories. Open now shows only open items; Closed shows only non-merged closed items; Merged shows only merged pull requests. This prevents merged items from appearing under Closed and improves accuracy of filtered results. Other filters (search, repository, date range) remain unchanged.

@netlify
Copy link

netlify bot commented Aug 28, 2025

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 9e90722
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/68b0c12da1b24e0008fc85fc
😎 Deploy Preview https://deploy-preview-200--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 28, 2025

Walkthrough

Updated Tracker.tsx filterData to explicitly branch filterType into open, closed, and merged, making categories disjoint. Closed now excludes merged by checking closed state without merged_at. Other filters (title search, repository, start/end dates) are unchanged.

Changes

Cohort / File(s) Summary
PR filter logic
src/pages/Tracker/Tracker.tsx
Refactored filterData to three explicit branches: merged → !!pull_request?.merged_at; closed → state === "closed" && !pull_request?.merged_at; open → state === "open". Ensures closed excludes merged; other filtering unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Tracker UI
  participant Filter as filterData
  participant Item as PR Item

  UI->>Filter: Apply filters (filterType, search, repo, dates)
  alt filterType == "merged"
    Filter->>Item: include if !!pull_request?.merged_at
  else filterType == "closed"
    Filter->>Item: include if state==="closed" && !pull_request?.merged_at
  else filterType == "open"
    Filter->>Item: include if state==="open"
  end
  Note over Filter: Then apply searchTitle, repository, startDate, endDate
  Filter-->>UI: Return filtered list
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Closed filter should show only closed PRs, excluding merged (#166)

Poem

I nibble through branches, neat and terse,
Sorting PRs in a tidy universe.
Open hops left, merged leaps right—
Closed stays snug by moonlit night.
With whiskered logic, bugs take flight! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

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

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
🪧 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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit 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/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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: 0

🧹 Nitpick comments (2)
src/pages/Tracker/Tracker.tsx (2)

104-115: Make filtering more explicit and robust; also verify data source populates merged_at.

Some GitHub endpoints don’t include pull_request.merged_at unless you fetch PR details. If merged_at is missing, “merged” will show empty. Refactor to a switch and keep semantics unchanged.

Apply within this range:

-      filtered = filtered.filter((item) => {
-        if (filterType === "merged") {
-          return !!item.pull_request?.merged_at
-        }
-        else if (filterType === "closed") {
-          return item.state === "closed" && !item.pull_request?.merged_at
-        }
-        else {
-          //open
-          return item.state === "open"
-        }
-      });
+      filtered = filtered.filter((item) => {
+        switch (filterType) {
+          case "merged":
+            return Boolean(item.pull_request?.merged_at);
+          case "closed":
+            return item.state === "closed" && !item.pull_request?.merged_at;
+          case "open":
+            return item.state === "open";
+          default:
+            return true;
+        }
+      });

Optionally, narrow the filter type to prevent invalid values elsewhere:

type StateFilter = "all" | "open" | "closed" | "merged";

To verify data shape, please confirm your fetch layer sets pull_request.merged_at for PRs (e.g., GraphQL or pulls.get). If you want, I can generate a script to scan the repo for where merged_at is sourced.


81-87: Effect dependencies don’t match the comment; either include username (and fetchData) or fix the comment.

As written, the effect won’t re-fetch on username change. If that’s intended, update the comment. If not, include deps.

-  // Fetch data when username, tab, or page changes
-  useEffect(() => {
+  // Fetch data when username, tab, or page changes
+  useEffect(() => {
     if (username) {
       fetchData(username, page + 1, ROWS_PER_PAGE);
     }
-  }, [tab, page]);
+  }, [username, tab, page, fetchData]);

If fetchData isn’t stable, wrap it with useCallback in the hook or suppress the dep intentionally and update the comment to avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cda5a3a and 9e90722.

📒 Files selected for processing (1)
  • src/pages/Tracker/Tracker.tsx (1 hunks)
🔇 Additional comments (1)
src/pages/Tracker/Tracker.tsx (1)

104-115: Closed filter now correctly excludes merged PRs — aligns with #166.

Logic makes “merged”, “closed (not merged)”, and “open” disjoint. Good fix.

@Srijatalamarla Srijatalamarla changed the title fix: "closed" filter in PR section fix: 'closed' filter behavior in PR section Aug 28, 2025
@mehul-m-prajapati mehul-m-prajapati merged commit 22e52f9 into GitMetricsLab:main Aug 29, 2025
7 checks passed
@github-actions
Copy link

🎉🎉 Thank you for your contribution! Your PR #200 has been merged! 🎉🎉

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.

🐛 Bug Report: PR close filter is not working as expected

2 participants