diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index e18a342..9de54ab 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -43,7 +43,6 @@ export class GraphWebview extends WebviewWithConfigBase { private selectedRepository?: Repository; private currentLog?: GitLog; private repoDisposable: Disposable | undefined; - private defaultTitle?: string; private previewBanner?: boolean; constructor(container: Container) { @@ -55,7 +54,6 @@ export class GraphWebview extends WebviewWithConfigBase { 'Commit Graph', Commands.ShowGraphPage, ); - this.defaultTitle = this.title; this.disposables.push({ dispose: () => void this.repoDisposable?.dispose() }); } @@ -325,7 +323,7 @@ export class GraphWebview extends WebviewWithConfigBase { } if (this.selectedRepository !== undefined) { - this.title = `${this.defaultTitle}: ${this.selectedRepository.formattedName}`; + this.title = `${this.originalTitle}: ${this.selectedRepository.formattedName}`; } const [commitsAndLog, remotes, tags, branches, stashCommits] = await Promise.all([ diff --git a/src/plus/webviews/timeline/timelineWebview.ts b/src/plus/webviews/timeline/timelineWebview.ts index 037c1ea..3479da8 100644 --- a/src/plus/webviews/timeline/timelineWebview.ts +++ b/src/plus/webviews/timeline/timelineWebview.ts @@ -42,7 +42,6 @@ export class TimelineWebview extends WebviewBase { private _context: Context; /** The context the webview should have */ private _pendingContext: Partial | undefined; - private _originalTitle: string; constructor(container: Container) { super( @@ -53,7 +52,6 @@ export class TimelineWebview extends WebviewBase { 'Visual File History', Commands.ShowTimelinePage, ); - this._originalTitle = this.title; this._context = { uri: undefined, period: defaultPeriod, @@ -235,7 +233,7 @@ export class TimelineWebview extends WebviewBase { const repoPath = gitUri.repoPath!; const title = gitUri.relativePath; - this.title = `${this._originalTitle}: ${gitUri.fileName}`; + this.title = `${this.originalTitle}: ${gitUri.fileName}`; const [currentUser, log] = await Promise.all([ this.container.git.getCurrentUser(repoPath), diff --git a/src/webviews/webviewBase.ts b/src/webviews/webviewBase.ts index da75a8a..9a33c14 100644 --- a/src/webviews/webviewBase.ts +++ b/src/webviews/webviewBase.ts @@ -35,7 +35,7 @@ export abstract class WebviewBase implements Disposable { title: string, showCommand: Commands, ) { - this._title = title; + this._originalTitle = this._title = title; this.disposables.push(registerCommand(showCommand, this.onShowCommand, this)); } @@ -44,6 +44,11 @@ export abstract class WebviewBase implements Disposable { this._disposablePanel?.dispose(); } + private _originalTitle: string | undefined; + get originalTitle(): string | undefined { + return this._originalTitle; + } + private _title: string; get title(): string { return this._panel?.title ?? this._title;