Repo tab bar: open-count badges next to Issues and Pulls #319
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#319
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's requested
Add a count badge next to the Issues and Pulls tabs in the repo tab bar showing the number of open issues / open pull requests. Badge only renders when the count is > 0.
Current state (code evidence)
TABSarray +<For>render inweb/src/pages/Repo.jsx:160-170/:603-612— plain<A>links with label text, no per-tab data slots.GET …/issues?state=openreturns{issues, more}(a windowed page, capped at 100 — not a count), and pulls are the same (ListPRs→{pulls, more}).OpenIssues intexists only on the milestone shape (internal/issues/model.go:171). There is no cheap "open count for the repo" anywhere — the badge needs one, or it would cost a full list fetch per tab render.Proposed design
Open/ClosedRecentcard arrays (internal/issues/model.go:141-145), so open-issue count islen(ix.Open)(O(1) read of an existing object; same index the list endpoint serves from). Pulls should mirror this (verify the pulls index shape; if pulls lack a state-partitioned index, either add one or count via the existing store listing with the same index-first discipline — planner's call).GET …/api,summaryBodyininternal/api/summary.go:12) withopen_issues/open_pullsints, OR add count endpoints (GET …/api/issues/count,…/api/pulls/count). Recommended: ride the summary — the tab bar already renders from the shell which holds the shared summary signal (RepoCtx), so the badge needs zero new requests; the counts are there on every repo page already. Summary is SWR/ETag'd on head sha — the cache trap from #235/#247 applies: an issue/PR mutation with no ref move would serve stale counts — the ETag must incorporate the collab-state version (or the counts ride ano-cacheclass per the #280 decision once landed). Call this out in the implementation.useData(REPO_TTL). Acceptable, but two extra requests per repo view for one badge.TABSentry (or the<For>body) soissues/pullstabs render<Show when={count > 0}><span class="…rounded-full bg-emerald-600 text-white text-xs…">{count}</span></Show>after the label. Match the app's existing count-pill styling (the notification tray badge / milestone counts usechip-family styling — reuse rather than invent). Hide at 0 (GitHub semantics: no zero badges).issue/pullframes; the shell (or the badge) should adjust counts on frames rather than waiting for the next summary revalidation — theadjustSummary-style pattern exists inlib/reactions.jsfor in-place counters. Scope: at minimum invalidate the summary entry on frames; optimistic count adjust is a nice-to-have.Acceptance criteria
issue/pullstream frames update the badge without a full reload (invalidate-at-minimum).Fixed by #322 (branch fix/issue-319): open-count badges ride the repo summary (open_issues/open_pulls + ~c ETag suffix), tab render hides at 0, stream + mutation-site invalidation per the #318 pattern. SWR class retained per the #235/#240 precedent, coordinated with #280. Tests + docs in the PR — review welcome, not merging per instructions.
REVIEW PR #322 (fix/issue-319, commit
f71e7fe) — verified in scratch worktree /tmp/pr322 (removed afterward). No browser (tests + reasoning, per instructions). Main worktree untouched (still clean apart from pre-existing untracked .opencode/).FINDINGS — all acceptance criteria hold, no fixes needed:
VERIFICATION (scratch worktree, commit
f71e7fe):MERGE RECOMMENDATION: ready to merge.
Fixed by PR #322 (review clean; counts + ETag + zero-new-requests verified; 606/606), merged. Closing.