Skip to content

Commit e76841f

Browse files
committed
Prevents overriding user-selected graph rows
1 parent b0e6b0a commit e76841f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/webviews/plus/graph/graphWebview.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
343343
private _search: GitGraphSearch | undefined;
344344
private _searchIdCounter = getScopedCounter();
345345
private _selectedId?: string;
346+
private _honorSelectedId = false;
346347
private _selectedRows: Record<string, SelectedRowState> | undefined;
347348
private _showDetailsView: Config['graph']['showDetailsView'];
348349
private _theme: ColorTheme | undefined;
@@ -479,6 +480,8 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
479480
id = (await this.container.git.getRepositoryService(arg.ref.repoPath).revision.resolveRevision(id)).sha;
480481
}
481482

483+
// Make sure we honor the selection to ensure we won't override it with the default selection
484+
this._honorSelectedId = true;
482485
this.setSelectedRows(id);
483486

484487
if (this._graph != null) {
@@ -3045,9 +3048,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
30453048
let selectedId = this._selectedId;
30463049
let selectionChanged = false;
30473050

3048-
// Skip default row selection if we have a pending search request
3049-
// to avoid jumping to WIP/HEAD before the search is applied
3051+
// Skip default row selection if we are honoring the selected id or we have a pending search request
3052+
// to avoid overriding an honored selection or jumping to WIP/HEAD before the search is applied
30503053
if (
3054+
!this._honorSelectedId &&
30513055
searchRequest == null &&
30523056
selectedId !== uncommitted &&
30533057
hasWorkingChanges &&
@@ -3058,6 +3062,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
30583062
this.setSelectedRows(uncommitted);
30593063
selectedId = this._selectedId;
30603064
}
3065+
this._honorSelectedId = false;
30613066

30623067
const columns = this.getColumns();
30633068
const columnSettings = this.getColumnSettings(columns);

0 commit comments

Comments
 (0)