fix(desktop): keep New file/Deleted badge visible in single-file diffs

The /dev/null label fix made getDiffFileLabel return the bare file path
for new/deleted files, which now matches fallbackFilePath in single-file
diffs — so showFileHeader skipped the per-file header entirely, hiding
the New file/Deleted type badge and the +/- change counts.

Show the header whenever the diff type is notable (add/delete/rename/
copy), while still collapsing it for plain modifications where it would
only repeat the path shown in the card header.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
This commit is contained in:
Matt Toohey
2026-07-10 17:16:53 +10:00
co-authored by Claude Fable 5
parent 4bca6e10e8
commit e3c9dfcfee
@@ -79,10 +79,13 @@ export function DiffViewer({
<div className="space-y-3">
{files.map((file) => {
const label = getDiffFileLabel(file, fallbackFilePath);
const showFileHeader =
files.length > 1 || !fallbackFilePath || label !== fallbackFilePath;
const { additions, deletions } = countDiffFileChanges(file);
const diffType = normalizeDiffType(file.type);
const showFileHeader =
files.length > 1 ||
!fallbackFilePath ||
label !== fallbackFilePath ||
diffType !== "modify";
const fileKey = [
file.oldPath || "",
file.newPath || "",