Skip to content

Commit 771fe88

Browse files
committed
refactor
1 parent 9acd026 commit 771fe88

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,19 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
149149
activeCustomization(project)?.let { activeCustom ->
150150
if (customizations.isEmpty()) {
151151
invalidateSelectedAndNotify(project)
152-
} else if (!customizations.any { latestCustom -> latestCustom.arn == activeCustom.arn } ||
153-
(activeCustom.profile != null && activeCustom.profile != QRegionProfileManager.getInstance().activeProfile(project))
154-
) {
152+
} else if (customizations.none { latestCustom -> latestCustom.arn == activeCustom.arn }) {
155153
invalidateSelectedAndNotify(project)
154+
} else {
155+
// for backward compatibility, previous schema didn't have profile arn, so backfill profile here if it's null
156+
if (activeCustom.profile == null) {
157+
customizations.find { c -> c.arn == activeCustom.arn }?.profile?.let { p ->
158+
activeCustom.profile = p
159+
}
160+
}
161+
162+
if (activeCustom.profile != null && activeCustom.profile != QRegionProfileManager.getInstance().activeProfile(project)) {
163+
invalidateSelectedAndNotify(project)
164+
}
156165
}
157166
}
158167

0 commit comments

Comments
 (0)