Skip to content

Commit 408befe

Browse files
authored
fix(amazonq): sign-in page may not render in rare scenarios (#5370)
Problem: VSC workbench can throw an error sometimes if we try to focus the panel too quickly. Error: View already awaiting revival Solution: Use our command to focus the panel and give time for the ext to load by sending this to the back of the queue after 1 second.
1 parent 9fd5ff7 commit 408befe

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Sign-in page may fail to render in rare circumstances."
4+
}

packages/amazonq/src/extension.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
initialize,
2929
initializeComputeRegion,
3030
messages,
31+
placeholder,
3132
setContext,
3233
} from 'aws-core-vscode/shared'
3334
import { ExtStartUpSources, telemetry } from 'aws-core-vscode/telemetry'
@@ -36,6 +37,7 @@ import { join } from 'path'
3637
import * as semver from 'semver'
3738
import * as vscode from 'vscode'
3839
import { registerCommands } from './commands'
40+
import { focusAmazonQPanel } from 'aws-core-vscode/codewhispererChat'
3941

4042
export const amazonQContextPrefix = 'amazonq'
4143

@@ -125,8 +127,11 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
125127
await vscode.commands.executeCommand('workbench.action.webview.reloadWebviewAction')
126128

127129
if (AuthUtils.ExtensionUse.instance.isFirstUse()) {
128-
CommonAuthWebview.authSource = ExtStartUpSources.firstStartUp
129-
await vscode.commands.executeCommand('workbench.view.extension.amazonq')
130+
// Give time for the extension to finish initializing.
131+
globals.clock.setTimeout(async () => {
132+
CommonAuthWebview.authSource = ExtStartUpSources.firstStartUp
133+
void focusAmazonQPanel.execute(placeholder, 'firstStartUp')
134+
}, 1000)
130135
}
131136

132137
await telemetry.auth_userState.run(async () => {

0 commit comments

Comments
 (0)