Skip to content

Add conditional rendering for empty data state#748

Open
aayam0304 wants to merge 3 commits into
GitMetricsLab:mainfrom
aayam0304:patch-1
Open

Add conditional rendering for empty data state#748
aayam0304 wants to merge 3 commits into
GitMetricsLab:mainfrom
aayam0304:patch-1

Conversation

@aayam0304

@aayam0304 aayam0304 commented Jun 27, 2026

Copy link
Copy Markdown

###Related issue 👍
📜 Description
Hello @mehul-m-prajapati

When searching for a user’s issues or pull requests, if there are no results, the page only shows:
0–0 of 0

This creates a confusing user experience and doesn’t clearly indicate that no issues or PRs exist.

Steps to Reproduce:

Open the Tracker page.

Enter a GitHub username that has no issues/PRs.

Click Fetch Data.

Actual Behavior:
The table displays 0–0 of 0 with no clear explanation.

###solution:

Updated the GitHub Tracker empty state handling. Previously, when a search yielded no results or a user had no issues/PRs, the data table component would display an empty view showing only "0–0 of 0", leading to a confusing user experience.

I implemented conditional rendering inside the TableBody component in Tracker.tsx. Now, if the fetched data array is empty, it elegantly spans a friendly message across the columns telling the user exactly what happened, dynamically adjusting based on whether they are viewing the Issues or Pull Requests tab.


How Has This Been Tested?

  • Manual Testing:
  • Entered a GitHub username with zero active issues/PRs.
  • Verified that navigating to the Issues tab correctly displays: "No issues found for this user".
  • Verified that navigating to the Pull Requests tab correctly displays: "No pull requests available".
  • Confirmed that the table formatting, pagination grid, and dark mode theme remain intact and un-broken.

Screenshots

image

Type of Change

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

Please count Under GSSoC '26

Thankyou ,
Aayam

Summary by CodeRabbit

  • Bug Fixes
    • Improved the tracker table so it now shows a clear “no results” message when there are no matching items.
    • The empty state is now more precise: it shows view-specific messaging for Issues vs. Pull requests, and differentiates between no items at all vs. no matches on the current page.

@netlify

netlify Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 0cf2eed
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a3fd5a42bbed800082e903e
😎 Deploy Preview https://deploy-preview-748--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

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 055f4afd-0a61-4e4c-9f5e-5c428eb349c7

📥 Commits

Reviewing files that changed from the base of the PR and between 26aa5c4 and 0cf2eed.

📒 Files selected for processing (1)
  • src/pages/Tracker/Tracker.tsx

📝 Walkthrough

Walkthrough

Tracker table body now shows distinct empty-state rows for zero total results and for empty filtered pages, and otherwise renders the existing rows.

Changes

Tracker empty-state rendering

Layer / File(s) Summary
Table body conditional render
src/pages/Tracker/Tracker.tsx
<TableBody> now renders a tab-specific full-width row when totalCount is zero, a “No matches found on this page…” row when the filtered page is empty, and the existing mapped rows otherwise.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Poem

A bunny peeks at the table with glee,
“No issues? No PRs?” — now it’s easy to see.
When pages run dry or filters go thin,
A neat little message hops right back in.
Hoppity hooray, the empty state sings 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding conditional rendering for empty tracker data states.
Description check ✅ Passed The description includes all required sections and testing details, though the Related Issue section lacks a specific issue number.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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/pages/Tracker/Tracker.tsx`:
- Around line 354-358: The empty-state branch in Tracker.tsx currently uses
currentFilteredData in the table body, so it can incorrectly show the global “No
issues found for this user” / “No pull requests available” message on later
pages when TablePagination still has results. Update the Tracker component’s
conditional rendering to reserve that message for totalCount === 0, and when
only currentFilteredData is empty show a filter/page-specific empty state or
reset page when filters change. Use the existing tab, totalCount,
currentFilteredData, and page handling in Tracker to place the fix.
🪄 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: 7a494b03-9b9a-4fb9-bf87-9556e4836a5c

📥 Commits

Reviewing files that changed from the base of the PR and between 53f820b and 26aa5c4.

📒 Files selected for processing (1)
  • src/pages/Tracker/Tracker.tsx

Comment thread src/pages/Tracker/Tracker.tsx Outdated
Updated the conditional rendering logic for displaying messages when there are no issues or pull requests. Enhanced user feedback for empty states.
Improve empty state messages in Tracker component
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.

1 participant