Skip to content

fix(miner-details): make filter button counts respect search query#1115

Open
plind-junior wants to merge 3 commits into
entrius:testfrom
plind-junior:fix/miner-details-filter-counts
Open

fix(miner-details): make filter button counts respect search query#1115
plind-junior wants to merge 3 commits into
entrius:testfrom
plind-junior:fix/miner-details-filter-counts

Conversation

@plind-junior
Copy link
Copy Markdown
Contributor

@plind-junior plind-junior commented May 13, 2026

Summary

Filter button counts on the Miner Details page now update live as the user types in the search box. Previously the All/Open/Merged/Closed (PR tab) and All/Open/Solved/Closed (Open Issues tab) counts were computed from the full unfiltered dataset, so users saw stale numbers like "Open (42)" even when the visible list had shrunk to one row.

Fixes the bug described in the linked issue.
Fixes #1114

Changes

src/components/miners/MinerPRsTable.tsx

Scope the count computation to the same search + author filters that drive the visible table, with statusFilter: 'all' so the active button doesn't zero out the others.

ts const statusCounts = useMemo(() => { if (!prs) return { all: 0, open: 0, merged: 0, closed: 0 }; const scope = filterPrs(prs, { author: selectedAuthor, includeNumber: true, searchQuery, statusFilter: 'all', }); return getPrStatusCounts(scope); }, [prs, selectedAuthor, searchQuery]); ​

src/components/miners/MinerOpenDiscoveryIssuesByRepo.tsx

  • Extracted the issue-search filter from applyIssueFilter into a reusable applyIssueSearch helper.
  • mineCounts and otherCounts now run through applyIssueSearch with each section's own search query (mineSearch / otherSearch), so the two sections' filter buttons update independently.

How counts behave now

Scope used for counts Search Author chip Active status filter
Active ✓ (PR tab only) ✗ (excluded so inactive buttons stay meaningful)

Each button shows the number of rows that would be selected if you clicked it under the current search/author scope.

Test plan

  • Open /miners/details?githubId=…Pull Requests tab.
  • Note counts in the four filter buttons.
  • Type a query that matches few rows — counts shrink with the table.
  • Clear the query — counts return to full dataset.
  • Click an author chip — counts reflect just that author.
  • Switch to Issue Discovery → Open Issues.
  • Type in the "Your open discovery issues" search — its 4 buttons update, the "Other" section's buttons are unaffected.
  • Type in the "Other open discovery issues" search — vice versa.
  • npm run type-check passes.

Notes

  • Active status filter is intentionally excluded from the count scope. Including it would zero out every other button when one is active, which defeats the purpose of having a filter bar.
  • No new dependencies; reuses existing filterPrs and refactors a small inline filter into applyIssueSearch.
Screencast.from.2026-05-13.22-35-26.mp4

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter button counts on Miner Details tabs don't update when typing in the search box

1 participant