Skip to content

Commit fe19cfa

Browse files
committed
Fixes #4431 ensures search edit updates query
1 parent 8eccd59 commit fe19cfa

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Fixes editing search result in Search & Compare view failure ([#4431](https://github.com/gitkraken/vscode-gitlens/issues/4431))
12+
913
## [17.2.1] - 2025-06-26
1014

1115
### Changed

src/views/nodes/resultsCommitsNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class ResultsCommitsNodeBase<Type extends TreeViewNodeTypes, View extends
4242
protected override readonly parent: ViewNode,
4343
public readonly repoPath: string,
4444
private _label: string,
45-
private readonly _results: {
45+
protected readonly _results: {
4646
query: (limit: number | undefined) => Promise<CommitsQueryResults>;
4747
comparison?: { ref1: string; ref2: string; range: GitRevisionRange };
4848
deferred?: boolean;
@@ -215,7 +215,7 @@ export class ResultsCommitsNodeBase<Type extends TreeViewNodeTypes, View extends
215215
private _commitsQueryResultsPromise: Promise<CommitsQueryResults> | undefined;
216216
private async getCommitsQueryResults() {
217217
if (this._commitsQueryResultsPromise == null) {
218-
this._commitsQueryResultsPromise ??= this._results.query(
218+
this._commitsQueryResultsPromise = this._results.query(
219219
this.limit ?? configuration.get('advanced.maxSearchItems'),
220220
);
221221
const results = await this._commitsQueryResultsPromise;

src/views/nodes/searchResultsNode.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ export class SearchResultsNode extends ResultsCommitsNodeBase<'search-results',
123123
await executeGitCommand({
124124
command: 'search',
125125
prefillOnly: true,
126-
state: {
127-
repo: this.repoPath,
128-
...this.search,
129-
showResultsInSideBar: this,
130-
},
126+
state: { repo: this.repoPath, ...this.search, showResultsInSideBar: this },
131127
});
132128

133129
return;
@@ -138,11 +134,13 @@ export class SearchResultsNode extends ResultsCommitsNodeBase<'search-results',
138134

139135
this._search = search.pattern;
140136
this._labels = search.labels;
137+
this._results.query = createSearchQuery(this.view, this.repoPath, this._search, this._labels);
138+
this._results.deferred = true;
141139

142140
// Remove the existing stored item and save a new one
143141
await this.replace(currentId, true);
144142

145-
void this.triggerChange(false);
143+
void this.triggerChange(true);
146144
queueMicrotask(() => this.view.reveal(this, { expand: true, focus: true, select: true }));
147145
}
148146

0 commit comments

Comments
 (0)