@devries-cameron20 / t3code Mirror · read-only / commits / 6053a7878d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 18:00 UTC

fix(web): PR file stats ignore the hide-whitespace toggle (#16162)

oliver committed Oct 7, 2026 at 22:24 UTC 6053a7878d24e5fd596d2b417ed94964a4b9c1c6
1 file changed +21 -7
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
+21 -7
@@ -37,6 +37,7 @@ import { orderDiffFiles } from "./pullRequestFileOrder.logic";
37 import {
38 buildFileDiffRenderKey,
39 fnv1a32,
40 + getDiffLineStat,
41 getRenderablePatch,
42 resolveDiffThemeName,
43 resolveFileDiffPath,
@@ -596,6 +597,23 @@ function PullRequestCodeTab({
597 ),
598 [loadedSlices],
599 );
600 + const sourceFileStats = useMemo(
601 + () =>
602 + new Map(
603 + parsedSlices.flatMap((parsed) =>
604 + parsed?.kind === "files"
605 + ? parsed.files.map(
606 + (file, index) =>
607 + [
608 + buildFileDiffRenderKey(file),
609 + getDiffLineStat([parsed.sourceFiles[index] ?? file]),
610 + ] as const,
611 + )
612 + : [],
613 + ),
614 + ),
615 + [parsedSlices],
616 + );
617 const fileKeys = useMemo(() => items.map((item) => item.id), [items]);
618 const collapsedFileKeys = useMemo(
619 () => new Set(items.filter((item) => item.collapsed === true).map((item) => item.id)),
@@ -811,12 +829,8 @@ function PullRequestCodeTab({
829 const renderHeaderMetadata = useCallback(
830 (item: CodeViewItem<ReviewAnnotationGroup>) => {
831 if (item.type !== "diff") return null;
814 - let additions = 0;
815 - let deletions = 0;
816 - for (const hunk of item.fileDiff.hunks) {
817 - additions += hunk.additionLines;
818 - deletions += hunk.deletionLines;
819 - }
832 + let { additions, deletions } =
833 + sourceFileStats.get(item.id) ?? getDiffLineStat([item.fileDiff]);
834 const path = resolveFileDiffPath(item.fileDiff);
835 if (additions === 0 && deletions === 0) {
836 const withheld = omittedFileStats.get(path);
@@ -864,7 +878,7 @@ function PullRequestCodeTab({
878 </span>
879 );
880 },
867 - [omittedFileStats],
881 + [omittedFileStats, sourceFileStats],
882 );
883
884 const diffViewOptions = useMemo(