per-repo diff stats (#1961)

This commit is contained in:
Gabriel Gordon-Hall
2026-01-13 09:32:16 +00:00
committed by GitHub
parent 118650872b
commit 57e802e2c9
5 changed files with 27 additions and 6 deletions

View File

@@ -342,7 +342,7 @@ export function WorkspacesLayout() {
[renameBranch]
);
// Compute diff stats from real diffs
// Compute aggregate diff stats from real diffs (for WorkspacesMainContainer)
const diffStats = useMemo(
() => ({
filesChanged: realDiffs.length,
@@ -380,21 +380,33 @@ export function WorkspacesLayout() {
}
}
// Compute per-repo diff stats
const repoDiffs = realDiffs.filter((d) => d.repoId === repo.id);
const filesChanged = repoDiffs.length;
const linesAdded = repoDiffs.reduce(
(sum, d) => sum + (d.additions ?? 0),
0
);
const linesRemoved = repoDiffs.reduce(
(sum, d) => sum + (d.deletions ?? 0),
0
);
return {
id: repo.id,
name: repo.display_name || repo.name,
targetBranch: repo.target_branch || 'main',
commitsAhead: repoStatus?.commits_ahead ?? 0,
remoteCommitsAhead: repoStatus?.remote_commits_ahead ?? 0,
filesChanged: diffStats.filesChanged,
linesAdded: diffStats.linesAdded,
linesRemoved: diffStats.linesRemoved,
filesChanged,
linesAdded,
linesRemoved,
prNumber,
prUrl,
prStatus,
};
}),
[repos, diffStats, branchStatus]
[repos, realDiffs, branchStatus]
);
// Content for logs panel (either process logs or tool content)