From 26856a6a6aaef45084a877604838099577e875dd Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 1 Feb 2018 23:53:32 -0500 Subject: [PATCH] Fixes GitLens view refreshing --- src/views/gitExplorer.ts | 30 ++++++++++++++++++------------ src/views/resultsExplorer.ts | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts index 30748bd..354e018 100644 --- a/src/views/gitExplorer.ts +++ b/src/views/gitExplorer.ts @@ -74,6 +74,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider(WorkspaceState.GitExplorerView, GitExplorerView.Repository); - } + let view = this._view; - if (initializing) { - this._view = view; - setCommandContext(CommandContext.GitExplorerView, this._view); + if (initializing || configuration.changed(e, configuration.name('gitExplorer')('view').value)) { + view = this.config.view; + if (view === GitExplorerView.Auto) { + view = Container.context.workspaceState.get(WorkspaceState.GitExplorerView, GitExplorerView.Repository); + } - this.setRoot(await this.getRootNode(window.activeTextEditor)); + if (initializing) { + this._view = view; + setCommandContext(CommandContext.GitExplorerView, this._view); - this._disposable = window.registerTreeDataProvider('gitlens.gitExplorer', this); - } - else { - this.reset(view); + this.setRoot(await this.getRootNode(window.activeTextEditor)); + + this._disposable = window.registerTreeDataProvider('gitlens.gitExplorer', this); + + return; + } } + + this.reset(view!); } private onRepositoriesChanged() { diff --git a/src/views/resultsExplorer.ts b/src/views/resultsExplorer.ts index ec3e4f8..294f9d2 100644 --- a/src/views/resultsExplorer.ts +++ b/src/views/resultsExplorer.ts @@ -54,6 +54,7 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider