Share one GroupTotals in the session board - #34
Merged
Conversation
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>
luhe19001
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
RepoGroupHeaderandBranchRoweach computed the same two totals and rendered the same "N sessions · X tok · $Y" span. Both copies were identical, down to theUnpricedModelWarningwrapper and the singular/plural switch.Changes
GroupTotalsand call it from both. The tworeducepairs 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 .— passednpx vitest run— passed (2 files, 7 tests)npm run build— passedgetTotalTokens(session.tokens), 0reduction in the file, down from two.No rendered-output test here. Unlike the
TokenBreakdownextraction, the span moves verbatim with only its surroundingdivleft 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.