Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot leave comments on hunks in large diffs #6574

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/diffHunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export async function parseDiff(
continue;
}

const diffHunks = review.patch ? parsePatch(review.patch) : [];
const diffHunks = review.patch ? parsePatch(review.patch) : undefined;
fileChanges.push(
new InMemFileChange(
parentCommit,
Expand All @@ -364,7 +364,7 @@ export async function parseDiff(
review.previous_filename,
review.patch ?? '',
diffHunks,
review.blob_url,
review.blob_url
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class InMemFileChange implements SimpleFileChange {
public readonly fileName: string,
public readonly previousFileName: string | undefined,
public readonly patch: string,
public readonly diffHunks: DiffHunk[],
public readonly diffHunks: DiffHunk[] | undefined,
public readonly blobUrl: string,
) {}
) { }
}

export class SlimFileChange implements SimpleFileChange {
Expand All @@ -42,5 +42,5 @@ export class SlimFileChange implements SimpleFileChange {
public readonly status: GitChangeType,
public readonly fileName: string,
public readonly previousFileName: string | undefined,
) {}
) { }
}
2 changes: 1 addition & 1 deletion src/view/fileChangeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export abstract class FileChangeModel {
async diffHunks(): Promise<DiffHunk[]> {
let diffHunks: DiffHunk[] = [];

if (this.change instanceof InMemFileChange) {
if (this.change instanceof InMemFileChange && this.change.diffHunks) {
return this.change.diffHunks;
} else if (this.status !== GitChangeType.RENAME) {
try {
Expand Down