Skip to content

Commit 61cb961

Browse files
committed
Fix smol issues
1 parent d5cbc42 commit 61cb961

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/deployment/deploymentManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,16 @@ export class DeploymentManager implements vscode.Disposable {
261261
this.client
262262
.getExperiments()
263263
.then((experiments) => {
264+
if (!this.isAuthenticated()) {
265+
return;
266+
}
264267
this.contextManager.set(
265268
"coder.agentsEnabled",
266269
experiments.includes("agents"),
267270
);
268271
})
269272
.catch((err) => {
270273
this.logger.warn("Failed to fetch experiments", err);
271-
// Default to hidden when we cannot determine.
272274
this.contextManager.set("coder.agentsEnabled", false);
273275
});
274276
}

src/webviews/chat/chatPanelProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class ChatPanelProvider
109109
private static readonly AUTH_RETRY_BASE_MS = 500;
110110

111111
private sendAuthToken(attempt = 0): void {
112+
clearTimeout(this.authRetryTimer);
112113
const token = this.client.getSessionToken();
113114
if (!token) {
114115
if (attempt < ChatPanelProvider.MAX_AUTH_RETRIES) {
@@ -212,7 +213,7 @@ export class ChatPanelProvider
212213
iframe.contentWindow.postMessage({
213214
type: 'coder:vscode-auth-bootstrap',
214215
payload: { token: data.token },
215-
}, '${allowedOrigin}');
216+
}, '${allowedOrigin}');
216217
}
217218
218219
if (data.type === 'coder:auth-error') {

test/mocks/testHelpers.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import axios, {
22
AxiosError,
33
AxiosHeaders,
44
type AxiosAdapter,
5-
type AxiosInstance,
65
type AxiosResponse,
76
type InternalAxiosRequestConfig,
87
} from "axios";
@@ -543,14 +542,6 @@ export class MockCoderApi implements Pick<
543542
this._disposed = true;
544543
});
545544

546-
// Minimal axios-like stub for getAxiosInstance().
547-
readonly getAxiosInstance = vi.fn(
548-
() =>
549-
({
550-
get: vi.fn().mockResolvedValue({ data: [] }),
551-
}) as unknown as AxiosInstance,
552-
);
553-
554545
readonly getExperiments = vi.fn(
555546
(): Promise<Experiment[]> => Promise.resolve([]),
556547
);

0 commit comments

Comments
 (0)