Skip to content

fix(ui): align activity heading count with sidebar#258

Merged
mpiton merged 1 commit intomainfrom
codex/fix-activity-count-consistency-250
Apr 13, 2026
Merged

fix(ui): align activity heading count with sidebar#258
mpiton merged 1 commit intomainfrom
codex/fix-activity-count-consistency-250

Conversation

@mpiton
Copy link
Copy Markdown
Owner

@mpiton mpiton commented Apr 13, 2026

Summary

  • align the Activity view heading with the same unread activity count used by the sidebar badge
  • keep the feed filtering behavior limited to the list contents instead of changing the section header count
  • add regression coverage at both the component and app integration levels

Root Cause

The sidebar badge used stats.unreadActivity, while the Activity view header displayed the count of currently visible feed items. That made the two numbers diverge whenever the loaded or filtered list did not match the total unread count.

Validation

  • npm test -- src/components/ActivityFeed/ActivityFeed.test.tsx src/App.test.tsx
  • npx oxlint src/App.tsx src/components/ActivityFeed/ActivityFeed.tsx src/App.test.tsx src/components/ActivityFeed/ActivityFeed.test.tsx

Closes #250


Summary by cubic

Fixes inconsistent counts by aligning the Activity view header with the sidebar badge. The header now shows total unread from stats.unreadActivity, not the filtered list. Closes #250.

  • Bug Fixes
    • Pass stats.unreadActivity from useGitHubData to ActivityFeed via headerCount.
    • Keep feed filters scoped to list items; header count stays the same.
    • Add component and app tests to prevent regressions.

Written for commit 8ecfe1d. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Activity feed header now displays the total unread activity count instead of only showing visible items.
  • Tests

    • Improved test coverage for activity feed header functionality, including validation of unread count display.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a1aa364-7972-4bb0-bbc1-0b56a251e524

📥 Commits

Reviewing files that changed from the base of the PR and between e92b77a and 8ecfe1d.

📒 Files selected for processing (4)
  • src/App.test.tsx
  • src/App.tsx
  • src/components/ActivityFeed/ActivityFeed.test.tsx
  • src/components/ActivityFeed/ActivityFeed.tsx

📝 Walkthrough

Walkthrough

The PR fixes an activity count discrepancy between the sidebar badge and activity view heading by introducing an optional headerCount prop to ActivityFeed, piping the total unread activity count from useGitHubData() stats through the component hierarchy to ensure consistent count display across UI surfaces.

Changes

Cohort / File(s) Summary
Test Infrastructure
src/App.test.tsx, src/components/ActivityFeed/ActivityFeed.test.tsx
Refactored App mock to use typed test helpers (makeActivity, makeGitHubDataMock) with configurable overrides; added test case verifying ActivityFeed prioritizes headerCount prop (149) over visible item count (1).
ActivityFeed Component
src/components/ActivityFeed/ActivityFeed.tsx
Extended ActivityFeedProps with optional headerCount?: number prop; updated logic to compute sectionCount as headerCount ?? visible.length, ensuring header displays the provided count rather than only visible items.
App Integration
src/App.tsx
Added destructuring of stats from useGitHubData() and passes headerCount={stats?.unreadActivity} to ActivityFeed when rendering the feed view.

Possibly related PRs

  • mpiton/prism#112: Modifies App.tsx and useGitHubData() stats consumption for wiring stats into a new StatsBar component.
  • mpiton/prism#56: Original PR that added the ActivityFeed component and App rendering logic now being extended by this PR.
  • mpiton/prism#252: Related modifications to ActivityFeed component and tests, adding hideHeader prop to control header rendering alongside this PR's headerCount prop changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops with glee,
149 now matches what all can see!
Props flow down through branches tall,
The count's consistent, one and all! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(ui): align activity heading count with sidebar' clearly and concisely summarizes the main objective of aligning the Activity view heading count with the sidebar badge count.
Linked Issues check ✅ Passed The PR successfully addresses the primary objective from issue #250 by using stats.unreadActivity from useGitHubData to display the unread activity count consistently between the sidebar and Activity view heading.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the fix and test coverage for issue #250; no out-of-scope modifications are present.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-activity-count-consistency-250

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

@mpiton mpiton changed the title [codex] fix(ui): align activity heading count with sidebar fix(ui): align activity heading count with sidebar Apr 13, 2026
@mpiton mpiton marked this pull request as ready for review April 13, 2026 06:20
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 13, 2026

Greptile Summary

This PR fixes the inconsistency between the sidebar badge (stats.unreadActivity) and the Activity view heading (previously visible.length) by introducing an optional headerCount prop on ActivityFeed and wiring it to stats?.unreadActivity in App.tsx. Filtering and search continue to affect only the rendered list, not the heading count. The mock refactor in App.test.tsx is a clean improvement that makes per-test overrides straightforward.

Confidence Score: 5/5

Safe to merge — the change is minimal, well-scoped, and backed by both unit and integration tests.

No P0 or P1 findings. The ?? fallback correctly handles the undefined/0 distinction, stats?.unreadActivity is safely guarded, and two new tests directly exercise the new behavior.

No files require special attention.

Important Files Changed

Filename Overview
src/components/ActivityFeed/ActivityFeed.tsx Adds optional headerCount prop; header now uses it (when provided) instead of visible.length, while list filtering behavior is unchanged.
src/App.tsx Extracts stats from useGitHubData() and passes stats?.unreadActivity as headerCount to ActivityFeed, aligning it with the sidebar badge source.
src/App.test.tsx Refactors mock into makeGitHubDataMock factory, moves default mock setup into beforeEach, and adds integration test verifying the heading uses stats.unreadActivity.
src/components/ActivityFeed/ActivityFeed.test.tsx Adds component-level regression test confirming headerCount takes precedence over visible.length when provided.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[useGitHubData] -->|stats.unreadActivity| B[App MainContent]
    A -->|dashboard.recentActivity| B
    B -->|headerCount| C[ActivityFeed]
    B -->|activities| C

    C --> D{isLoading?}
    D -- yes --> E[sectionCount = undefined]
    D -- no --> F{headerCount defined?}
    F -- yes --> G[sectionCount = headerCount]
    F -- no --> H[sectionCount = visible.length]

    G --> I[SectionHead shows headerCount]
    H --> I2[SectionHead shows visible.length]
    E --> I3[SectionHead shows no count]

    C --> J[Filter and search applied]
    J --> K[Render visible items only]
Loading

Reviews (1): Last reviewed commit: "fix(ui): align activity heading count wi..." | Re-trigger Greptile

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

@mpiton mpiton merged commit f5a05a8 into main Apr 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): Activity count discrepancy — sidebar shows 149 but view heading shows 49

1 participant