From e19b9cfaa939d9c4a38cc127b3ad3a58fd959c4a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 11 Oct 2023 12:00:51 -0400 Subject: [PATCH] Ensures WIP node gets selected properly --- src/plus/webviews/graph/graphWebview.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 7c9eb81..e4f58fe 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -1895,7 +1895,8 @@ export class GraphWebviewProvider implements WebviewProvider { // If we have a set of data refresh to the same set const limit = Math.max(defaultItemLimit, this._graph?.ids.size ?? defaultItemLimit); - const ref = this._selectedId == null || this._selectedId === uncommitted ? 'HEAD' : this._selectedId; + const selectedId = this._selectedId; + const ref = selectedId == null || selectedId === uncommitted ? 'HEAD' : selectedId; const columns = this.getColumns(); const columnSettings = this.getColumnSettings(columns); @@ -1928,7 +1929,9 @@ export class GraphWebviewProvider implements WebviewProvider { queueMicrotask(async () => { const data = await dataPromise; this.setGraph(data); - this.setSelectedRows(data.id); + if (selectedId !== uncommitted) { + this.setSelectedRows(data.id); + } void this.notifyDidChangeRefsVisibility(); void this.notifyDidChangeRows(true); @@ -1936,7 +1939,9 @@ export class GraphWebviewProvider implements WebviewProvider { } else { data = await dataPromise; this.setGraph(data); - this.setSelectedRows(data.id); + if (selectedId !== uncommitted) { + this.setSelectedRows(data.id); + } } const [accessResult, workingStatsResult, branchResult, lastFetchedResult] = await promises;