Skip to content

Commit 98b0d5d

Browse files
authored
refactor(amazonq): reduce extra call of listAvailableCustomization (aws#7242)
## Problem Customization will only have "1" parent profile, so theoretically we don't need another call of listAvailableCustomization to check if the new profile has access to given customization or not. Instead, we could simply switch to default customization (foundation). ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent e9ea808 commit 98b0d5d

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

packages/core/src/codewhisperer/util/customizationUtil.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const onProfileChangedListener: (event: ProfileChangedEvent) => any = asy
5959
if (event.intent === 'customization') {
6060
return
6161
}
62-
const logger = getLogger()
62+
6363
if (!event.profile) {
6464
await setSelectedCustomization(baseCustomization)
6565
return
@@ -69,16 +69,7 @@ export const onProfileChangedListener: (event: ProfileChangedEvent) => any = asy
6969
const selectedCustomization = getSelectedCustomization()
7070
// No need to validate base customization which has empty arn.
7171
if (selectedCustomization.arn.length > 0) {
72-
const customizationProvider = await CustomizationProvider.init(event.profile)
73-
const customizations = await customizationProvider.listAvailableCustomizations()
74-
75-
const r = customizations.find((it) => it.arn === selectedCustomization.arn)
76-
if (!r) {
77-
logger.debug(
78-
`profile ${event.profile.name} doesnt have access to customization ${selectedCustomization.name} but has access to ${customizations.map((it) => it.name)}`
79-
)
80-
await switchToBaseCustomizationAndNotify()
81-
}
72+
await switchToBaseCustomizationAndNotify()
8273
}
8374
}
8475

0 commit comments

Comments
 (0)