Skip to content

Commit 6105d9d

Browse files
committed
Fix hanging promise causing unstable login state
1 parent ae4df51 commit 6105d9d

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class Commands {
209209

210210
await this.deploymentManager.clearDeployment();
211211

212-
void vscode.window
212+
vscode.window
213213
.showInformationMessage("You've been logged out of Coder!", "Login")
214214
.then((action) => {
215215
if (action === "Login") {

src/extension.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,25 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
7171
const deployment = await secretsManager.getCurrentDeployment();
7272

7373
// Shared handler for auth failures (used by interceptor + session manager)
74-
const handleAuthFailure = async (): Promise<void> => {
74+
const handleAuthFailure = (): Promise<void> => {
7575
deploymentManager.suspendSession();
76-
const action = await vscode.window.showWarningMessage(
77-
"Session expired. You have been signed out.",
78-
"Log In",
79-
);
80-
if (action === "Log In") {
81-
await commands.login({
82-
url: deploymentManager.getCurrentDeployment()?.url,
76+
vscode.window
77+
.showWarningMessage(
78+
"Session expired. You have been signed out.",
79+
"Log In",
80+
)
81+
.then(async (action) => {
82+
if (action === "Log In") {
83+
try {
84+
await commands.login({
85+
url: deploymentManager.getCurrentDeployment()?.url,
86+
});
87+
} catch (err) {
88+
output.error("Login failed", err);
89+
}
90+
}
8391
});
84-
}
92+
return Promise.resolve();
8593
};
8694

8795
// Create OAuth session manager - callback handles background refresh failures

0 commit comments

Comments
 (0)