Skip to content

Commit

Permalink
Improve view+welcome show/hide timing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 committed Nov 8, 2021
1 parent 5dc01ec commit 977acd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
{
"id": "github:activePullRequest:welcome",
"name": "Active Pull Request",
"when": "!github:initialized && github:focusedReview"
"when": "!github:stateValidated && github:focusedReview"
}
]
},
Expand Down Expand Up @@ -816,7 +816,7 @@
},
{
"view": "github:activePullRequest:welcome",
"when": "!github:initialized",
"when": "!github:stateValidated",
"contents": "Loading..."
}
],
Expand Down
11 changes: 8 additions & 3 deletions src/view/reviewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,23 @@ export class ReviewManager {
}
if (!this._validateStatusInProgress) {
Logger.appendLine('Review> Validate state in progress');
this._validateStatusInProgress = this.validateState(silent, openDiff);
this._validateStatusInProgress = this.validateStatueAndSetContext(silent, openDiff);
return this._validateStatusInProgress;
} else {
Logger.appendLine('Review> Queuing additional validate state');
this._validateStatusInProgress = this._validateStatusInProgress.then(async _ => {
return await this.validateState(silent, openDiff);
return await this.validateStatueAndSetContext(silent, openDiff);
});

return this._validateStatusInProgress;
}
}

private async validateStatueAndSetContext(silent: boolean, openDiff: boolean) {
await this.validateState(silent, openDiff);
await vscode.commands.executeCommand('setContext', 'github:stateValidated', true);
}

private async validateState(silent: boolean, openDiff: boolean) {
Logger.appendLine('Review> Validating state...');
await this._folderRepoManager.updateRepositories(silent);
Expand Down Expand Up @@ -862,7 +867,7 @@ export class ReviewManager {

private async updateFocusedViewMode(): Promise<void> {
const focusedSetting = vscode.workspace.getConfiguration(SETTINGS_NAMESPACE).get('focusedMode');
if (focusedSetting && this._folderRepoManager.activePullRequest) {
if (focusedSetting) {
vscode.commands.executeCommand('setContext', FOCUS_REVIEW_MODE, true);
await this._context.workspaceState.update(FOCUS_REVIEW_MODE, true);
} else {
Expand Down

0 comments on commit 977acd8

Please sign in to comment.