Skip to content

Commit 9c89c53

Browse files
authored
fix(dev): conditional for stop code gen on async event #5896
## Problem The function onAsyncEventProgress its reused for both Gumby and Dev feature, which enabled for both (not the expected scenario). ## Solution Added a condition to prevent and only enable for Dev.
1 parent f806ae0 commit 9c89c53

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
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": "Amazon Q /dev: fix for stop button showing for Code Transformation"
4+
}

packages/core/src/amazonq/webview/ui/apps/featureDevChatConnector.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ interface ChatPayload {
1818
export interface ConnectorProps {
1919
sendMessageToExtension: (message: ExtensionMessage) => void
2020
onMessageReceived?: (tabID: string, messageData: any, needToShowAPIDocsTab: boolean) => void
21-
onAsyncEventProgress: (tabID: string, inProgress: boolean, message: string) => void
21+
onAsyncEventProgress: (
22+
tabID: string,
23+
inProgress: boolean,
24+
message: string,
25+
messageId: string | undefined,
26+
enableStopAction: boolean
27+
) => void
2228
onChatAnswerReceived?: (tabID: string, message: ChatItem, messageData: any) => void
2329
sendFeedback?: (tabId: string, feedbackPayload: FeedbackPayload) => void | undefined
2430
onError: (tabID: string, message: string, title: string) => void
@@ -246,7 +252,14 @@ export class Connector {
246252
}
247253

248254
if (messageData.type === 'asyncEventProgressMessage') {
249-
this.onAsyncEventProgress(messageData.tabID, messageData.inProgress, messageData.message ?? undefined)
255+
const enableStopAction = true
256+
this.onAsyncEventProgress(
257+
messageData.tabID,
258+
messageData.inProgress,
259+
messageData.message ?? undefined,
260+
messageData.messageId ?? undefined,
261+
enableStopAction
262+
)
250263
return
251264
}
252265

packages/core/src/amazonq/webview/ui/apps/gumbyChatConnector.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import { ChatPayload } from '../connector'
1616
export interface ConnectorProps {
1717
sendMessageToExtension: (message: ExtensionMessage) => void
1818
onMessageReceived?: (tabID: string, messageData: any, needToShowAPIDocsTab: boolean) => void
19-
onAsyncEventProgress: (tabID: string, inProgress: boolean, message: string, messageId: string) => void
19+
onAsyncEventProgress: (
20+
tabID: string,
21+
inProgress: boolean,
22+
message: string,
23+
messageId: string,
24+
enableStopAction: boolean
25+
) => void
2026
onChatAnswerReceived?: (tabID: string, message: ChatItem, messageData: any) => void
2127
onChatAnswerUpdated?: (tabID: string, message: ChatItem) => void
2228
onQuickHandlerCommand: (tabID: string, command: string, eventId?: string) => void
@@ -196,7 +202,8 @@ export class Connector {
196202
messageData.tabID,
197203
messageData.inProgress,
198204
messageData.message,
199-
messageData.messageId
205+
messageData.messageId,
206+
false
200207
)
201208
break
202209
case 'authNeededException':

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ export const createMynahUI = (
195195
tabID: string,
196196
inProgress: boolean,
197197
message: string | undefined,
198-
messageId: string | undefined = undefined
198+
messageId: string | undefined = undefined,
199+
enableStopAction: boolean = false
199200
) => {
200201
if (inProgress) {
201202
mynahUI.updateStore(tabID, {
202203
loadingChat: true,
203204
promptInputDisabledState: true,
204-
cancelButtonWhenLoading: true,
205+
cancelButtonWhenLoading: enableStopAction,
205206
})
206207

207208
if (message && messageId) {

0 commit comments

Comments
 (0)