Open
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 6, 2026
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sessions/components/DiffStatsChip.tsx:16-57
**Logic duplicated between `DiffStatsChip` and `DiffStatsBadge`**
Both components share the same `useTaskDiffStats` call, `useReviewNavigationStore` subscription pattern, `handleClick` toggle logic, `GitDiff` icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (`Flex` vs `Button`), tooltip side (`top` vs `bottom`), and the review mode opened (`"expanded"` vs `"split"`). Consider extracting the shared state/callback logic into a shared hook (e.g. `useDiffStatsToggle`) to satisfy OnceAndOnlyOnce.
Reviews (1): Last reviewed commit: "feat(code): add diff stats to convo view" | Re-trigger Greptile |
Comment on lines
+16
to
+57
| export function DiffStatsChip({ task }: DiffStatsChipProps) { | ||
| const taskId = task.id; | ||
| const { filesChanged, linesAdded, linesRemoved } = useTaskDiffStats(task); | ||
|
|
||
| const reviewMode = useReviewNavigationStore( | ||
| (s) => s.reviewModes[taskId] ?? "closed", | ||
| ); | ||
| const setReviewMode = useReviewNavigationStore((s) => s.setReviewMode); | ||
|
|
||
| if (filesChanged === 0) return null; | ||
|
|
||
| const isOpen = reviewMode !== "closed"; | ||
|
|
||
| const handleClick = () => { | ||
| setReviewMode(taskId, isOpen ? "closed" : "expanded"); | ||
| }; | ||
|
|
||
| return ( | ||
| <Tooltip | ||
| content={isOpen ? "Close review" : "Open review"} | ||
| shortcut={formatHotkey(SHORTCUTS.TOGGLE_REVIEW_PANEL)} | ||
| side="top" | ||
| > | ||
| <Flex | ||
| align="center" | ||
| gap="1" | ||
| onClick={handleClick} | ||
| className="cursor-pointer select-none text-[13px] text-gray-10 tabular-nums hover:text-gray-12" | ||
| > | ||
| <GitDiff size={12} className="shrink-0" /> | ||
| <Text className="text-[13px]"> | ||
| {filesChanged} {filesChanged === 1 ? "file" : "files"} | ||
| </Text> | ||
| {linesAdded > 0 && ( | ||
| <Text className="text-(--green-9) text-[13px]">+{linesAdded}</Text> | ||
| )} | ||
| {linesRemoved > 0 && ( | ||
| <Text className="text-(--red-9) text-[13px]">-{linesRemoved}</Text> | ||
| )} | ||
| </Flex> | ||
| </Tooltip> | ||
| ); |
Contributor
There was a problem hiding this comment.
Logic duplicated between
DiffStatsChip and DiffStatsBadge
Both components share the same useTaskDiffStats call, useReviewNavigationStore subscription pattern, handleClick toggle logic, GitDiff icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (Flex vs Button), tooltip side (top vs bottom), and the review mode opened ("expanded" vs "split"). Consider extracting the shared state/callback logic into a shared hook (e.g. useDiffStatsToggle) to satisfy OnceAndOnlyOnce.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/components/DiffStatsChip.tsx
Line: 16-57
Comment:
**Logic duplicated between `DiffStatsChip` and `DiffStatsBadge`**
Both components share the same `useTaskDiffStats` call, `useReviewNavigationStore` subscription pattern, `handleClick` toggle logic, `GitDiff` icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (`Flex` vs `Button`), tooltip side (`top` vs `bottom`), and the review mode opened (`"expanded"` vs `"split"`). Consider extracting the shared state/callback logic into a shared hook (e.g. `useDiffStatsToggle`) to satisfy OnceAndOnlyOnce.
How can I resolve this? If you propose a fix, please make it concise.
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.

Problem
there's no way to see number of files changed without opening + expanding review panel
Changes
adds a lil diff indicator by the context indicator
clicking will open the review panel in expanded mode
How did you test this?
manually
Publish to changelog?
yes