Skip to content

Commit 97afa3f

Browse files
eamodiod13
authored andcommitted
Fixes "undefined" result counts
1 parent c4f699c commit 97afa3f

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

CHANGELOG.md

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

1111
- Improves AI-related error messages ([#4227](https://github.com/gitkraken/vscode-gitlens/issues/4227))
1212

13+
### Fixed
14+
15+
- Fixes `undefined` sometimes showing for search results in the _Search Commits_ command and _Search & Compare_ view
16+
1317
## [17.0.2] - 2025-04-11
1418

1519
### Changed

src/commands/git/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export class SearchGitCommand extends QuickCommand<State> {
229229
log == null
230230
? `No results for ${state.query}`
231231
: `${pluralize('result', log.count, {
232-
format: c => (log.hasMore ? `${c}+` : undefined),
232+
format: c => (log.hasMore ? `${c}+` : String(c)),
233233
})} for ${state.query}`,
234234
picked: context.commit?.ref,
235235
showInSideBarCommand: new ActionQuickPickItem(

src/views/nodes/searchResultsNode.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,10 @@ export class SearchResultsNode extends ViewNode<'search-results', SearchAndCompa
8888
let deferred;
8989
if (this._searchQueryOrLog == null) {
9090
deferred = true;
91-
this._searchQueryOrLog = this.getSearchQuery({
92-
label: this._labels.queryLabel,
93-
});
91+
this._searchQueryOrLog = this.getSearchQuery({ label: this._labels.queryLabel });
9492
} else if (typeof this._searchQueryOrLog !== 'function') {
9593
this._searchQueryOrLog = this.getSearchQuery(
96-
{
97-
label: this._labels.queryLabel,
98-
},
94+
{ label: this._labels.queryLabel },
9995
this._searchQueryOrLog,
10096
);
10197
}
@@ -105,13 +101,8 @@ export class SearchResultsNode extends ViewNode<'search-results', SearchAndCompa
105101
this,
106102
this.repoPath,
107103
this._labels.label,
108-
{
109-
query: this._searchQueryOrLog,
110-
deferred: deferred,
111-
},
112-
{
113-
expand: false,
114-
},
104+
{ query: this._searchQueryOrLog, deferred: deferred },
105+
{ expand: false },
115106
true,
116107
);
117108
}
@@ -212,7 +203,7 @@ export class SearchResultsNode extends ViewNode<'search-results', SearchAndCompa
212203
: label.resultsType;
213204

214205
return `${pluralize(resultsType.singular, count, {
215-
format: c => (log?.hasMore ? `${c}+` : undefined),
206+
format: c => (log?.hasMore ? `${c}+` : String(c)),
216207
plural: resultsType.plural,
217208
zero: 'No',
218209
})} ${label.label}`;

0 commit comments

Comments
 (0)