diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 0469ce1..99b626f 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -945,9 +945,8 @@ export class GraphWebview extends WebviewBase { return false; } - const hiddenRefs = this.getHiddenRefs(); return this.notify(DidChangeRefsVisibilityNotificationType, { - hiddenRefs: await this.getHiddenRefsById(hiddenRefs), + hiddenRefs: this.getHiddenRefs(), }); } @@ -1121,13 +1120,21 @@ export class GraphWebview extends WebviewBase { } private getHiddenRefs(): Record | undefined { - return this.container.storage.getWorkspace('graph:hiddenRefs'); + return this.filterHiddenRefs(this.container.storage.getWorkspace('graph:hiddenRefs')); } - private async getHiddenRefsById( - hiddenRefs: Record | undefined, - ): Promise { - if (hiddenRefs == null) return undefined; + private filterHiddenRefs(hiddenRefs: Record | undefined): GraphHiddenRefs | undefined { + if (hiddenRefs == null || this.repository == null) return undefined; + + const filteredRefs: GraphHiddenRefs = {}; + + for (const id in hiddenRefs) { + if (getRepoPathFromBranchOrTagId(id) === this.repository.path) { + filteredRefs[id] = hiddenRefs[id]; + } + } + + return filteredRefs; // This validation has too much performance impact. So we decided to comment those lines // for v13 and have it as tech debt to solve after we launch. @@ -1159,8 +1166,9 @@ export class GraphWebview extends WebviewBase { // return filteredHiddenRefsById; // For v13, we return directly the hidden refs without validating them - return Promise.resolve(hiddenRefs); + return hiddenRefs; } + private getColumnSettings(columns: Record | undefined): GraphColumnsSettings { const columnsSettings: GraphColumnsSettings = { ...defaultGraphColumnsSettings, @@ -1297,8 +1305,6 @@ export class GraphWebview extends WebviewBase { } const columns = this.getColumns(); - const hiddenRefs = this.getHiddenRefs(); - const hiddenRefsByIds = await this.getHiddenRefsById(hiddenRefs); return { previewBanner: this.previewBanner, @@ -1325,7 +1331,7 @@ export class GraphWebview extends WebviewBase { context: { header: this.getColumnHeaderContext(columns), }, - hiddenRefs: hiddenRefsByIds, + hiddenRefs: this.getHiddenRefs(), nonce: this.cspNonce, workingTreeStats: getSettledValue(workingStatsResult) ?? { added: 0, deleted: 0, modified: 0 }, }; @@ -1981,3 +1987,7 @@ function isGraphItemRefContext(item: unknown, refType?: GitReference['refType']) (refType == null || item.webviewItemValue.ref.refType === refType) ); } + +function getRepoPathFromBranchOrTagId(id: string): string { + return id.split('|', 1)[0]; +}