Skip to content

Commit 4800116

Browse files
authored
featureDev: Fix /transform to show when /dev shows (#4094)
Problem: - Right now /transform will show/hide depending on the initial auth status when opening up Amazon Q. This doesn't behave correctly because a user can technically open up Amazon Q and then change their auth state after Solution: - Make /transform show when /dev shows
1 parent 53f468d commit 4800116

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
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: Fixed an issue where sometimes /transform won't appear when switching between idC/builder id"
4+
}

src/amazonq/webview/ui/main.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, gumby
4444
// used to keep track of whether or not featureDev is enabled and has an active idC
4545
let isFeatureDevEnabled = featureDevInitEnabled
4646

47-
const isGumbyEnabled = gumbyInitEnabled
47+
let isGumbyEnabled = gumbyInitEnabled
4848

49-
const tabDataGenerator = new TabDataGenerator({
49+
let tabDataGenerator = new TabDataGenerator({
5050
isFeatureDevEnabled,
5151
isGumbyEnabled,
5252
})
@@ -63,12 +63,22 @@ export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, gumby
6363
// eslint-disable-next-line prefer-const
6464
connector = new Connector({
6565
tabsStorage,
66-
onUpdateAuthentication: (featureDevEnabled: boolean, authenticatingTabIDs: string[]): void => {
67-
isFeatureDevEnabled = featureDevEnabled
66+
onUpdateAuthentication: (isAmazonQEnabled: boolean, authenticatingTabIDs: string[]): void => {
67+
isFeatureDevEnabled = isAmazonQEnabled
68+
isGumbyEnabled = isAmazonQEnabled
6869

69-
quickActionHandler.isFeatureDevEnabled = isFeatureDevEnabled
70-
tabDataGenerator.quickActionsGenerator.isFeatureDevEnabled = isFeatureDevEnabled
70+
quickActionHandler = new QuickActionHandler({
71+
mynahUI,
72+
connector,
73+
tabsStorage,
74+
isFeatureDevEnabled,
75+
isGumbyEnabled,
76+
})
7177

78+
tabDataGenerator = new TabDataGenerator({
79+
isFeatureDevEnabled,
80+
isGumbyEnabled,
81+
})
7282
// Set the new defaults for the quick action commands in all tabs now that isFeatureDevEnabled was enabled/disabled
7383
for (const tab of tabsStorage.getTabs()) {
7484
mynahUI.updateStore(tab.id, {
@@ -77,7 +87,7 @@ export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, gumby
7787
}
7888

7989
// Unlock every authenticated tab that is now authenticated
80-
if (featureDevEnabled) {
90+
if (isAmazonQEnabled) {
8191
for (const tabID of authenticatingTabIDs) {
8292
mynahUI.addChatItem(tabID, {
8393
type: ChatItemType.ANSWER,

src/amazonq/webview/ui/quickActions/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class QuickActionHandler {
2222
private connector: Connector
2323
private tabsStorage: TabsStorage
2424
private tabDataGenerator: TabDataGenerator
25-
public isFeatureDevEnabled: boolean
25+
private isFeatureDevEnabled: boolean
2626

2727
constructor(props: QuickActionsHandlerProps) {
2828
this.mynahUI = props.mynahUI

0 commit comments

Comments
 (0)