瀏覽代碼

Fixes error when adding same commit to search view

main
Eric Amodio 2 年之前
父節點
當前提交
0cb9b50b91
共有 6 個文件被更改,包括 16 次插入16 次删除
  1. +2
    -2
      src/views/nodes/autolinkedItemNode.ts
  2. +2
    -2
      src/views/nodes/autolinkedItemsNode.ts
  3. +4
    -4
      src/views/nodes/commitNode.ts
  4. +4
    -4
      src/views/nodes/pullRequestNode.ts
  5. +2
    -2
      src/views/nodes/resultsCommitsNode.ts
  6. +2
    -2
      src/views/nodes/resultsFilesNode.ts

+ 2
- 2
src/views/nodes/autolinkedItemNode.ts 查看文件

@ -10,7 +10,7 @@ import { ContextValues, ViewNode } from './viewNode';
export class AutolinkedItemNode extends ViewNode<ViewsWithCommits> {
constructor(
view: ViewsWithCommits,
parent: ViewNode,
protected override readonly parent: ViewNode,
public readonly repoPath: string,
public readonly item: Autolink | IssueOrPullRequest,
) {
@ -22,7 +22,7 @@ export class AutolinkedItemNode extends ViewNode {
}
override get id(): string {
return `${this.parent!.id!}:item(${this.item.id})`;
return `${this.parent.id}:item(${this.item.id})`;
}
getChildren(): ViewNode[] {

+ 2
- 2
src/views/nodes/autolinkedItemsNode.ts 查看文件

@ -20,7 +20,7 @@ export class AutolinkedItemsNode extends ViewNode {
constructor(
view: ViewsWithCommits,
parent: ViewNode,
protected override readonly parent: ViewNode,
public readonly repoPath: string,
public readonly log: GitLog,
private expand: boolean,
@ -30,7 +30,7 @@ export class AutolinkedItemsNode extends ViewNode {
}
override get id(): string {
return `${this.parent!.id}:results:autolinked:${this._instanceId}`;
return `${this.parent.id}:results:autolinked:${this._instanceId}`;
}
async getChildren(): Promise<ViewNode[]> {

+ 4
- 4
src/views/nodes/commitNode.ts 查看文件

@ -26,13 +26,13 @@ type State = {
export class CommitNode extends ViewRefNode<ViewsWithCommits | FileHistoryView, GitRevisionReference, State> {
static key = ':commit';
static getId(repoPath: string, sha: string): string {
return `${RepositoryNode.getId(repoPath)}${this.key}(${sha})`;
static getId(parent: ViewNode, repoPath: string, sha: string): string {
return `${parent.id}|${RepositoryNode.getId(repoPath)}${this.key}(${sha})`;
}
constructor(
view: ViewsWithCommits | FileHistoryView,
parent: ViewNode,
protected override readonly parent: ViewNode,
public readonly commit: GitCommit,
private readonly unpublished?: boolean,
public readonly branch?: GitBranch,
@ -47,7 +47,7 @@ export class CommitNode extends ViewRefNode
}
override get id(): string {
return `${this.parent?.id}|${CommitNode.getId(this.commit.repoPath, this.commit.sha)}`;
return CommitNode.getId(this.parent, this.commit.repoPath, this.commit.sha);
}
get isTip(): boolean {

+ 4
- 4
src/views/nodes/pullRequestNode.ts 查看文件

@ -7,8 +7,8 @@ import { ContextValues, ViewNode } from './viewNode';
export class PullRequestNode extends ViewNode<ViewsWithCommits> {
static key = ':pullrequest';
static getId(repoPath: string, id: string, refOrParent: string): string {
return `${RepositoryNode.getId(repoPath)}${this.key}(${id}):${refOrParent}`;
static getId(parent: ViewNode, repoPath: string, id: string, ref?: string): string {
return `${parent.id}|${RepositoryNode.getId(repoPath)}${this.key}(${id}):${ref}`;
}
public readonly pullRequest: PullRequest;
@ -17,7 +17,7 @@ export class PullRequestNode extends ViewNode {
constructor(
view: ViewsWithCommits,
parent: ViewNode,
protected override readonly parent: ViewNode,
pullRequest: PullRequest,
branchOrCommitOrRepoPath: GitBranch | GitCommit | string,
) {
@ -42,7 +42,7 @@ export class PullRequestNode extends ViewNode {
}
override get id(): string {
return PullRequestNode.getId(this.repoPath, this.pullRequest.id, this.branchOrCommit?.ref ?? this.parent!.id!);
return PullRequestNode.getId(this.parent, this.repoPath, this.pullRequest.id, this.branchOrCommit?.ref);
}
getChildren(): ViewNode[] {

+ 2
- 2
src/views/nodes/resultsCommitsNode.ts 查看文件

@ -27,7 +27,7 @@ export class ResultsCommitsNode
{
constructor(
view: View,
parent: ViewNode,
protected override readonly parent: ViewNode,
public readonly repoPath: string,
private _label: string,
private readonly _results: {
@ -65,7 +65,7 @@ export class ResultsCommitsNode
}
override get id(): string {
return `${this.parent!.id}:results:commits${this._options.id ? `:${this._options.id}` : ''}`;
return `${this.parent.id}:results:commits${this._options.id ? `:${this._options.id}` : ''}`;
}
async getChildren(): Promise<ViewNode[]> {

+ 2
- 2
src/views/nodes/resultsFilesNode.ts 查看文件

@ -30,7 +30,7 @@ export interface FilesQueryResults {
export class ResultsFilesNode extends ViewNode<ViewsWithCommits> {
constructor(
view: ViewsWithCommits,
parent: ViewNode,
protected override readonly parent: ViewNode,
public readonly repoPath: string,
public readonly ref1: string,
public readonly ref2: string,
@ -46,7 +46,7 @@ export class ResultsFilesNode extends ViewNode {
}
override get id(): string {
return `${this.parent!.id}:results:files`;
return `${this.parent.id}:results:files`;
}
get filter(): FilesQueryFilter | undefined {

||||||
x
 
000:0
Loading…
取消
儲存