Skip to content

feat(explorer): add "My Issues only" filter to Issues tab#144

Open
blinkeye-lcm wants to merge 2 commits into
MkDev11:mainfrom
blinkeye-lcm:feat/explorer-my-issues-only
Open

feat(explorer): add "My Issues only" filter to Issues tab#144
blinkeye-lcm wants to merge 2 commits into
MkDev11:mainfrom
blinkeye-lcm:feat/explorer-my-issues-only

Conversation

@blinkeye-lcm
Copy link
Copy Markdown
Contributor

@blinkeye-lcm blinkeye-lcm commented May 22, 2026

Summary

Adds a "My Issues only" toggle to the Issues tab of the Explorer page, matching the existing "My PRs only" toggle on the Pull Requests tab. When enabled, the listing narrows to issues authored by the signed-in user, and a small badge shows the total count.

Implementation mirrors the PR side end to end:

  • useIssueFilters gains a mineOnly state, and IssueState accepts 'mine'.
  • /api/repos/:owner/:name/issues reads mine_login and applies LOWER(author_login) = ? when state=mine. ETag version bumped so stale clients refetch.
  • /api/repos/:owner/:name/issues-meta returns mine_count when mine_login is provided. ETag version bumped.
  • RepoExplorer renders the toggle next to the author filter, derives issuesState = issueMineOnly ? 'mine' : issueState, and resets pagination on toggle change.
  • IssuesMetaResponse (in both types/entities.ts and lib/api-types.ts) gains the optional mine_count field.

Related Issues

Closes #143

Screenshot

Screenshot 2026-05-22 194730

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Other (describe):

Testing

  • pnpm build passes
  • Manual browser smoke test (for UI changes)
  • N/A, docs / config only

Verified behavior:

  • Toggle filters the Issues table to the signed-in user's issues.
  • Badge shows the correct count from issues-meta.
  • Pagination resets when the toggle flips.
  • Switching repos clears the toggle along with the other Issues filters.
  • Signed out users see the toggle but clicking it is a no-op, same as the PR side.

Checklist

  • Self-reviewed the diff
  • Follows existing code patterns and naming
  • No unrelated changes included
  • Documentation updated if behavior changed

Summary by CodeRabbit

  • New Features

    • Added "My Issues only" checkbox in the issues tab to view issues you authored
    • Shows a per-user matching-issues count next to the filter
    • Filter integrates with existing filters and resets pagination when toggled
  • Bug Fixes

    • Counts and filtered results now remain consistent and properly refresh when the user-specific filter changes

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 181662bd-5a94-4ae0-bed5-560945f5f765

📥 Commits

Reviewing files that changed from the base of the PR and between 5d8cc28 and 53ea87c.

📒 Files selected for processing (1)
  • src/app/api/repos/[owner]/[name]/issues/route.ts

📝 Walkthrough

Walkthrough

Adds a "My Issues only" toggle: client filter state and UI, mine_login support on /issues and /issues-meta, server-side mine_count computation, per-author filtering when state=mine, and ETag keys updated to vary by the mine filter.

Changes

My Issues Filter Feature

Layer / File(s) Summary
Type contracts and response shapes
src/components/repo-explorer/useIssueFilters.ts, src/lib/api-types.ts, src/types/entities.ts
IssueState now includes 'mine'; IssueFilters adds mineOnly and setMineOnly; IssuesMetaResponse adds optional mine_count?: number.
Issue filter state management hook
src/components/repo-explorer/useIssueFilters.ts
useIssueFilters initializes mineOnly, resets it in reset, and exposes mineOnly/setMineOnly.
Issues meta endpoint — user count computation
src/app/api/repos/[owner]/[name]/issues-meta/route.ts
Reads mine_login, includes it in ETag (issues-meta-v6), and conditionally computes/returns mine_count when provided.
Issues endpoint — author filtering by state
src/app/api/repos/[owner]/[name]/issues/route.ts
Advances ETag to issues-v5, includes mine_login in ETag inputs, extracts/trims mine_login, and when state==='mine' applies case-insensitive author-login filtering (or forces empty results) to both main and state-counts queries.
RepoExplorer UI and data fetching integration
src/components/RepoExplorer.tsx
Wires mineOnly into derived issuesState, includes mine_login in API calls when available, updates React Query keys to include me and issuesState, resets pagination on filter change, derives myIssueCount from meta, and renders the checkbox with count badge.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Poem

🐰
I hopped through code with a twitch and a twitch,
Tucked "My Issues" behind one tiny switch.
Now issues I made come into view,
A badge counts my work—hip hop hooray, woo! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.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 title 'feat(explorer): add "My Issues only" filter to Issues tab' accurately and concisely summarizes the primary change: adding a My Issues only filter feature to the Explorer page's Issues tab.
Linked Issues check ✅ Passed The PR fully implements all coding requirements from issue #143: adds a My Issues only toggle with badge count, filters issues by signed-in user when enabled, applies consistent styling to match PR toggle, handles signed-out user behavior, and updates both frontend components and API endpoints accordingly.
Out of Scope Changes check ✅ Passed All code changes directly support the My Issues only filter feature. Frontend components add the toggle UI and state management, API endpoints implement filtering and count logic, and type definitions support the new response field—all within scope of issue #143.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: lockfile failed supply-chain policy check. Run pnpm install locally to update the lockfile.


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

🤖 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/app/api/repos/`[owner]/[name]/issues/route.ts:
- Around line 132-135: The query logic allows state='mine' with a missing/empty
mineLogin, which results in no author or state filter and returns unintended
results; update both places that check state === 'mine' (the block that builds
where/args using mineLogin and the stateOnlyWhere clause) to defensively handle
a missing mineLogin by adding a short-circuit that forces an empty result (e.g.,
push '1 = 0' into where/stateOnlyWhere when state === 'mine' && !mineLogin) so
the API returns no rows instead of all issues; ensure you update the same logic
where the author filter is added (the place that pushes 'LOWER(i.author_login) =
?' and args.push(mineLogin.toLowerCase())) and the separate stateOnlyWhere path
to use the same defensive check.
🪄 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 Plus

Run ID: 0d4567c3-9516-473d-a0e9-88c03b553038

📥 Commits

Reviewing files that changed from the base of the PR and between 85ba452 and 5d8cc28.

📒 Files selected for processing (6)
  • src/app/api/repos/[owner]/[name]/issues-meta/route.ts
  • src/app/api/repos/[owner]/[name]/issues/route.ts
  • src/components/RepoExplorer.tsx
  • src/components/repo-explorer/useIssueFilters.ts
  • src/lib/api-types.ts
  • src/types/entities.ts

Comment thread src/app/api/repos/[owner]/[name]/issues/route.ts
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 "My Issues only" filter to the Issues tab on the Explorer page

1 participant