@@ -98,12 +98,10 @@ export const getSelectedCustomization = (): Customization => {
9898 return baseCustomization
9999 }
100100
101- const selectedCustomizationArr = globals . globalState . tryGet < { [ label : string ] : Customization } > (
101+ const selectedCustomization = globals . globalState . tryGet < Customization > (
102102 'CODEWHISPERER_SELECTED_CUSTOMIZATION' ,
103- Object ,
104- { }
103+ Object
105104 )
106- const selectedCustomization = selectedCustomizationArr [ AuthUtil . instance . profileName ]
107105
108106 if ( selectedCustomization && selectedCustomization . name !== '' ) {
109107 return selectedCustomization
@@ -112,9 +110,6 @@ export const getSelectedCustomization = (): Customization => {
112110 }
113111}
114112
115- // TODO: @hayemaxi Do NOT use AuthUtil.instance.profileName, migrate the old setting and use a single value instead of a map
116- // TODO: refactor to only ever have 1 customization
117-
118113/**
119114 * @param customization customization to select
120115 * @param isOverride if the API call is made from us (Q) but not users' intent, set isOverride to TRUE
@@ -132,15 +127,10 @@ export const setSelectedCustomization = async (customization: Customization, isO
132127 return
133128 }
134129 }
135- const selectedCustomizationObj = globals . globalState . tryGet < { [ label : string ] : Customization } > (
136- 'CODEWHISPERER_SELECTED_CUSTOMIZATION' ,
137- Object ,
138- { }
139- )
140- selectedCustomizationObj [ AuthUtil . instance . profileName ] = customization
130+
131+ await globals . globalState . update ( 'CODEWHISPERER_SELECTED_CUSTOMIZATION' , customization )
141132 getLogger ( ) . debug ( `Selected customization ${ customization . name } for ${ AuthUtil . instance . profileName } ` )
142133
143- await globals . globalState . update ( 'CODEWHISPERER_SELECTED_CUSTOMIZATION' , selectedCustomizationObj )
144134 if ( isOverride ) {
145135 await globals . globalState . update ( 'aws.amazonq.customization.overrideV2' , customization . arn )
146136 }
0 commit comments