From 3aa31b0d33f36f44ace59e592c5ef2b946e6aad6 Mon Sep 17 00:00:00 2001 From: Michael Hutchison Date: Sun, 17 Nov 2019 20:10:48 +1100 Subject: [PATCH] Apply the "Fetch" button state when the remotes of the repository change, instead of during the normal view render process. --- web/main.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/main.ts b/web/main.ts index f657a05f..5014c86e 100644 --- a/web/main.ts +++ b/web/main.ts @@ -153,7 +153,7 @@ class GitGraphView { this.showRemoteBranchesElem.checked = this.gitRepos[this.currentRepo].showRemoteBranches; this.maxCommits = this.config.initialLoadCommits; this.gitRemotes = []; - alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, false); + this.renderFetchButton(); this.closeCommitDetails(false); this.settingsWidget.close(); this.currentBranches = null; @@ -171,6 +171,9 @@ class GitGraphView { this.gitBranchHead = branchHead; this.gitRemotes = remotes; + // Update the state of the fetch button + this.renderFetchButton(); + // Configure current branches let globPatterns = []; @@ -470,7 +473,6 @@ class GitGraphView { /* Renderers */ private render() { - alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, this.gitRemotes.length > 0); this.renderTable(); this.renderGraph(); } @@ -687,6 +689,10 @@ class GitGraphView { this.findWidget.update([]); } + private renderFetchButton() { + alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, this.gitRemotes.length > 0); + } + public renderRefreshButton(enabled: boolean) { this.refreshBtnElem.title = enabled ? 'Refresh' : 'Refreshing'; this.refreshBtnElem.innerHTML = enabled ? SVG_ICONS.refresh : SVG_ICONS.loading;