Browse Source

Fixes #2738 not unique enough ids

main
Eric Amodio 1 year ago
parent
commit
12eba66bd9
7 changed files with 17 additions and 21 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      src/views/nodes/autolinkedItemsNode.ts
  3. +1
    -5
      src/views/nodes/compareBranchNode.ts
  4. +1
    -5
      src/views/nodes/compareResultsNode.ts
  5. +5
    -6
      src/views/nodes/resultsCommitsNode.ts
  6. +4
    -1
      src/views/nodes/resultsFilesNode.ts
  7. +4
    -3
      src/views/nodes/viewNode.ts

+ 1
- 0
CHANGELOG.md View File

@ -75,6 +75,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#2738](https://github.com/gitkraken/vscode-gitlens/issues/2738) - Element with id ... is already registered
- Fixes [#2728](https://github.com/gitkraken/vscode-gitlens/issues/2728) - Submodule commit graph will not open in the panel layout
- Fixes [#2734](https://github.com/gitkraken/vscode-gitlens/issues/2734) - 🐛 File History: Browse ... not working
- Fixes [#2671](https://github.com/gitkraken/vscode-gitlens/issues/2671) - Incorrect locale information provided GitLens

+ 1
- 1
src/views/nodes/autolinkedItemsNode.ts View File

@ -29,7 +29,7 @@ export class AutolinkedItemsNode extends ViewNode {
this._instanceId = instanceId++;
this.updateContext({ autolinksId: String(this._instanceId) });
this._uniqueId = getViewNodeId(`autolinks`, this.context);
this._uniqueId = getViewNodeId('autolinks', this.context);
}
override get id(): string {

+ 1
- 5
src/views/nodes/compareBranchNode.ts View File

@ -89,7 +89,6 @@ export class CompareBranchNode extends ViewNode
},
},
{
id: 'behind',
description: pluralize('commit', aheadBehindCounts?.behind ?? 0),
expand: false,
},
@ -112,7 +111,6 @@ export class CompareBranchNode extends ViewNode
},
},
{
id: 'ahead',
description: pluralize('commit', aheadBehindCounts?.ahead ?? 0),
expand: false,
},
@ -125,9 +123,7 @@ export class CompareBranchNode extends ViewNode
this.compareWithWorkingTree ? '' : this.branch.ref,
this.getFilesQuery.bind(this),
undefined,
{
expand: false,
},
{ expand: false },
),
];
}

+ 1
- 5
src/views/nodes/compareResultsNode.ts View File

@ -101,7 +101,6 @@ export class CompareResultsNode extends ViewNode {
},
},
{
id: 'behind',
description: pluralize('commit', aheadBehindCounts?.behind ?? 0),
expand: false,
},
@ -122,7 +121,6 @@ export class CompareResultsNode extends ViewNode {
},
},
{
id: 'ahead',
description: pluralize('commit', aheadBehindCounts?.ahead ?? 0),
expand: false,
},
@ -135,9 +133,7 @@ export class CompareResultsNode extends ViewNode {
this._ref.ref,
this.getFilesQuery.bind(this),
undefined,
{
expand: false,
},
{ expand: false },
),
];
}

+ 5
- 6
src/views/nodes/resultsCommitsNode.ts View File

@ -47,16 +47,15 @@ export class ResultsCommitsNode
query: () => Promise<FilesQueryResults>;
};
},
private readonly _options: {
id?: string;
description?: string;
expand?: boolean;
} = undefined!,
private readonly _options: { description?: string; expand?: boolean } = undefined!,
splatted?: boolean,
) {
super(GitUri.fromRepoPath(repoPath), view, parent);
this._uniqueId = getViewNodeId(`results-commits${_options?.id ? `+${_options.id}` : ''}`, this.context);
if (_results.direction != null) {
this.updateContext({ branchStatusUpstreamType: _results.direction });
}
this._uniqueId = getViewNodeId('results-commits', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
this._options = { expand: true, ..._options };

+ 4
- 1
src/views/nodes/resultsFilesNode.ts View File

@ -44,7 +44,10 @@ export class ResultsFilesNode extends ViewNode {
) {
super(GitUri.fromRepoPath(repoPath), view, parent);
this._uniqueId = getViewNodeId(`results-files${direction ? `+${direction}` : ''}`, this.context);
if (this.direction != null) {
this.updateContext({ branchStatusUpstreamType: this.direction });
}
this._uniqueId = getViewNodeId('results-files', this.context);
this._options = { expand: true, ..._options };
}

+ 4
- 3
src/views/nodes/viewNode.ts View File

@ -144,9 +144,10 @@ export function getViewNodeId(type: string, context: AmbientContext): string {
uniqueness += `/branch/${context.branch.id}`;
}
if (context.branchStatus != null) {
uniqueness += `/status/${context.branchStatus.upstream ?? '-'}${
context.branchStatusUpstreamType ? `/${context.branchStatusUpstreamType}` : ''
}`;
uniqueness += `/status/${context.branchStatus.upstream ?? '-'}`;
}
if (context.branchStatusUpstreamType != null) {
uniqueness += `/status-direction/${context.branchStatusUpstreamType}`;
}
if (context.reflog != null) {
uniqueness += `/reflog/${context.reflog.sha}+${context.reflog.selector}+${context.reflog.command}+${

||||||
x
 
000:0
Loading…
Cancel
Save