Skip to content

Share one GroupTotals in the session board - #34

Merged
calvintvu merged 1 commit into
mainfrom
board-group-totals
Aug 5, 2026
Merged

Share one GroupTotals in the session board#34
calvintvu merged 1 commit into
mainfrom
board-group-totals

Conversation

@calvintvu

@calvintvu calvintvu commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Context

RepoGroupHeader and BranchRow each computed the same two totals and rendered the same "N sessions · X tok · $Y" span. Both copies were identical, down to the UnpricedModelWarning wrapper and the singular/plural switch.

Changes

  • Extract GroupTotals and call it from both. The two reduce pairs move into it, so group totals are summed in one place.

Setting expectations on size: this is 14 lines added against 16 removed, not the ~8-line saving I estimated when I first flagged it. The value is one definition rather than two — a change to how a group total reads no longer has to be made in two places, and the two cannot drift apart.

Test

  • npx oxlint — passed (two pre-existing Fast Refresh warnings, unchanged)
  • npx prettier --check . — passed
  • npx vitest run — passed (2 files, 7 tests)
  • npm run build — passed
  • Confirmed one remaining getTotalTokens(session.tokens), 0 reduction in the file, down from two.

No rendered-output test here. Unlike the TokenBreakdown extraction, the span moves verbatim with only its surrounding div left in place, so the markup is unchanged by inspection. Worth a glance at the board view in review to confirm both the repo heading and the branch rows still read the same.

RepoGroupHeader and BranchRow each computed the same token and cost
totals and rendered the same "N sessions · X tok · $Y" span. The two
copies were identical.

Extract GroupTotals and call it from both. The two reduce pairs move
into it, so the totals are now summed in one place.

This is a small net line change, 14 added against 16 removed. The point
is one definition rather than two: a change to how a group total reads
no longer has to be made twice.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@calvintvu
calvintvu merged commit 7d3bfba into main Aug 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants