Skip to content

feat: add label filtering and sorting to IssueBacklog (#461)#487

Merged
ritik4ever merged 2 commits into
ritik4ever:mainfrom
MAN7A-afk:main
May 28, 2026
Merged

feat: add label filtering and sorting to IssueBacklog (#461)#487
ritik4ever merged 2 commits into
ritik4ever:mainfrom
MAN7A-afk:main

Conversation

@MAN7A-afk
Copy link
Copy Markdown
Contributor

@MAN7A-afk MAN7A-afk commented May 27, 2026

What changed

  • Added label filter chips generated dynamically from unique issue labels

  • Implemented multi-select label filtering using OR logic

  • Added sorting options for:

    • complexity (Trivial → High)
    • points (ascending and descending)
  • Added a "Clear filters" button to reset active filters and sorting

  • Updated IssueBacklog.tsx to handle filtering and sorting state cleanly

  • Added Vitest coverage to verify filtering by label reduces visible issues correctly

Testing done

  • Verified label chips render correctly from issue data
  • Tested multi-label filtering behavior
  • Tested sorting by complexity and points
  • Verified "Clear filters" resets state properly
  • Added Vitest test for label filtering functionality

Related issues

Closes #461

Checklist

  • I kept the change focused on the related issue.
  • I added or updated tests where useful.
  • I updated documentation where behavior changed.
  • I verified the app still builds or explained why verification was skipped.
  • [ ]

Summary by CodeRabbit

  • New Features

    • Added label-based filtering with interactive chip toggles (AND/OR behavior)
    • Added sorting controls for complexity and points (ascending/descending)
    • Added "Clear filters" button to reset active selections
    • Added "Showing X of Y issues" count message when filters are active
  • Tests

    • Added comprehensive test suite for filtering, sorting, and empty-state behaviors

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@MAN7A-afk is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@MAN7A-afk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@ritik4ever, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc5821c9-4644-4cde-ade4-618e28ae73f9

📥 Commits

Reviewing files that changed from the base of the PR and between 9012a84 and 11f265e.

📒 Files selected for processing (2)
  • frontend/src/components/IssueBacklog.test.tsx
  • frontend/src/components/IssueBacklog.tsx
📝 Walkthrough

Walkthrough

IssueBacklog now derives unique labels from the issues array, maintains activeLabels and sortKey state, and computes visibleIssues via useMemo by filtering on active labels and applying sort logic. The UI adds interactive label filter chips, a sort dropdown (default/complexity/points asc-desc), a conditional clear button, and renders per-issue label chips that reflect selection state. A comprehensive test suite validates filtering (single/multiple labels), sorting (complexity and points), state resets, empty states, and loading behavior.

Changes

IssueBacklog Filtering and Sorting

Layer / File(s) Summary
State management and filtering/sorting logic
frontend/src/components/IssueBacklog.tsx
Introduces SortKey type and complexity ordering constant; computes allLabels from issues; tracks activeLabels and sortKey state; provides toggle and clear handlers; derives visibleIssues via useMemo by applying active label filtering and selected sort mode.
UI controls and filtered issue rendering
frontend/src/components/IssueBacklog.tsx
Renders backlog-controls section with label filter chips, sort dropdown, and conditional clear button; displays filtered results count; renders visibleIssues list with interactive per-issue label chips reflecting active label selection.
Comprehensive test suite
frontend/src/components/IssueBacklog.test.tsx
Typed MOCK_ISSUES dataset and Vitest suite validating label filtering (single/multiple OR behavior, chip toggle with aria-pressed state), empty-state messaging, clear-filters reset, sorting by complexity and points (ascending/descending) with sort-key reset, and loading state behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Filters bloom like garden rows,
Labels sorted as the backlog grows,
Sort and sift with every click,
Complexity and points—neat trick!
Tests ensure each toggle glows.

🚥 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
Title check ✅ Passed The title 'feat: add label filtering and sorting to IssueBacklog (#461)' directly and concisely describes the main changes: adding label filtering and sorting to the IssueBacklog component.
Linked Issues check ✅ Passed All acceptance criteria from issue #461 are met: label chips derived from unique labels [in raw_summary], multi-select OR filtering logic [in raw_summary], sort by complexity and points [in raw_summary], Clear filters button [in raw_summary], and Vitest test for label filtering [in raw_summary].
Out of Scope Changes check ✅ Passed All changes in the pull request are directly related to the stated objectives: label filtering, sorting controls, Clear filters button, and corresponding test coverage for the IssueBacklog component.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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

@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: 1

🧹 Nitpick comments (1)
frontend/src/components/IssueBacklog.test.tsx (1)

86-103: ⚡ Quick win

Simplify the empty-state test to match its stated purpose.

The test name says "shows empty state message when no issues match the filter," but the implementation is convoluted with multiple cleanup() and render() calls. It ultimately just verifies that the message appears when issues={[]}, not when active filters produce zero results.

Since OR-logic filtering guarantees at least one match per active label (labels are derived from existing issues), the "no matches" case only occurs when the issues array is empty or changes externally. The current test is correct but confusing.

♻️ Proposed refactor to clarify intent
-  it("shows empty state message when no issues match the filter", () => {
+  it("shows empty state message when no issues are available", () => {
-    render(<IssueBacklog issues={MOCK_ISSUES} />);
-
-    // "docs" label only on issue 4; then also filter "backend" — but let's
-    // use a label that exists on no issue by passing a custom set
-    const noMatchIssues: OpenIssue[] = [
-      { id: "x", title: "X", summary: "s", complexity: "Trivial", points: 100, labels: ["alpha"] },
-    ];
-    cleanup();
-    render(<IssueBacklog issues={noMatchIssues} />);
-
-    fireEvent.click(screen.getByRole("button", { name: "alpha" }));
-    // deactivate to get 0 results — use an issue list where filter yields nothing
-    // Easier: render with empty issues and no labels
-    cleanup();
     render(<IssueBacklog issues={[]} />);
     expect(screen.getByText(/No issues match/i)).toBeInTheDocument();
   });
🤖 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 `@frontend/src/components/IssueBacklog.test.tsx` around lines 86 - 103, The
test for IssueBacklog is overly complex; simplify it to directly exercise the
empty-state scenario by rendering <IssueBacklog issues={[]} /> once and
asserting the "No issues match" message. Remove the intermediate renders,
cleanup() calls, and the label click (references: IssueBacklog, MOCK_ISSUES, the
test block named "shows empty state message when no issues match the filter");
optionally rename the test to "shows empty state message when issues array is
empty" to match intent.
🤖 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 `@frontend/src/components/IssueBacklog.tsx`:
- Around line 161-163: The empty-state message in IssueBacklog always says "No
issues match the selected filters." even when there are simply no issues and no
filters applied; update the render logic in IssueBacklog to check both
visibleIssues.length === 0 and whether any filters are active (e.g., the
component's filters state or props like
selectedFilters/activeFilters/assigneeFilter); if no issues and no active
filters show a neutral message like "No issues yet" or "There are no issues.",
otherwise keep "No issues match the selected filters." so the message reflects
whether filters are the cause.

---

Nitpick comments:
In `@frontend/src/components/IssueBacklog.test.tsx`:
- Around line 86-103: The test for IssueBacklog is overly complex; simplify it
to directly exercise the empty-state scenario by rendering <IssueBacklog
issues={[]} /> once and asserting the "No issues match" message. Remove the
intermediate renders, cleanup() calls, and the label click (references:
IssueBacklog, MOCK_ISSUES, the test block named "shows empty state message when
no issues match the filter"); optionally rename the test to "shows empty state
message when issues array is empty" to match intent.
🪄 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: d303b25c-2456-47cd-95b8-22db3394e61c

📥 Commits

Reviewing files that changed from the base of the PR and between f775986 and 9012a84.

📒 Files selected for processing (2)
  • frontend/src/components/IssueBacklog.test.tsx
  • frontend/src/components/IssueBacklog.tsx

Comment on lines +161 to +163
{visibleIssues.length === 0 ? (
<p className="muted">No issues match the selected filters.</p>
) : (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Conditionally adjust the empty-state message based on whether filters are active.

The message "No issues match the selected filters." is shown whenever visibleIssues.length === 0, including when issues={[]} and no filters are active. In that case, the message is misleading because there are no selected filters.

💬 Proposed fix to show context-appropriate empty-state message
-      {visibleIssues.length === 0 ? (
-        <p className="muted">No issues match the selected filters.</p>
-      ) : (
+      {visibleIssues.length === 0 ? (
+        <p className="muted">
+          {hasActiveFilters
+            ? "No issues match the selected filters."
+            : "No issues available."}
+        </p>
+      ) : (
🤖 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 `@frontend/src/components/IssueBacklog.tsx` around lines 161 - 163, The
empty-state message in IssueBacklog always says "No issues match the selected
filters." even when there are simply no issues and no filters applied; update
the render logic in IssueBacklog to check both visibleIssues.length === 0 and
whether any filters are active (e.g., the component's filters state or props
like selectedFilters/activeFilters/assigneeFilter); if no issues and no active
filters show a neutral message like "No issues yet" or "There are no issues.",
otherwise keep "No issues match the selected filters." so the message reflects
whether filters are the cause.

@ritik4ever ritik4ever merged commit 6d243c7 into ritik4ever:main May 28, 2026
0 of 2 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.

Add IssueBacklog label filtering and sorting

2 participants