@@ -566,17 +566,8 @@ export class ClineProvider
566566 * Save a single view-local state value. Only non-secret selections are persisted durably.
567567 */
568568 private async saveViewState ( key : keyof ExtensionState , value : any ) : Promise < void > {
569- if ( key === "mode" ) {
570- await this . savePersistedViewState ( { mode : value } )
571- } else if ( key === "currentApiConfigName" ) {
572- await this . savePersistedViewState ( { currentApiConfigName : value } )
573- }
574-
575- if ( value === undefined || value === null ) {
576- delete this . viewLocalState [ key ]
577- } else {
578- this . viewLocalState [ key ] = value
579- }
569+ await this . _saveViewLocalStateFromMutation ( { [ key ] : value } as Partial < RooCodeSettings > &
570+ Partial < ExtensionState > )
580571
581572 this . log ( `[saveViewState] Saved ${ String ( key ) } for viewId ${ this . viewId } ` )
582573 }
@@ -1855,11 +1846,9 @@ export class ClineProvider
18551846 this . updateGlobalState ( "currentApiConfigName" , name ) ,
18561847 this . providerSettingsManager . setModeConfig ( mode , id ) ,
18571848 this . contextProxy . setProviderSettings ( providerSettings ) ,
1858- this . saveViewState ( "currentApiConfigName" , name ) ,
1859- this . saveViewState ( "apiConfiguration" , providerSettings ) ,
18601849 ] )
18611850
1862- this . _updateViewLocalStateFromMutation ( {
1851+ await this . _saveViewLocalStateFromMutation ( {
18631852 listApiConfigMeta,
18641853 currentApiConfigName : name ,
18651854 apiConfiguration : providerSettings ,
@@ -1959,11 +1948,9 @@ export class ClineProvider
19591948 this . contextProxy . setValue ( "listApiConfigMeta" , listApiConfigMeta ) ,
19601949 this . contextProxy . setValue ( "currentApiConfigName" , name ) ,
19611950 this . contextProxy . setProviderSettings ( providerSettings ) ,
1962- this . saveViewState ( "currentApiConfigName" , name ) ,
1963- this . saveViewState ( "apiConfiguration" , providerSettings ) ,
19641951 ] )
19651952
1966- this . _updateViewLocalStateFromMutation ( {
1953+ await this . _saveViewLocalStateFromMutation ( {
19671954 listApiConfigMeta,
19681955 currentApiConfigName : name ,
19691956 apiConfiguration : providerSettings ,
@@ -3102,8 +3089,7 @@ export class ClineProvider
31023089
31033090 public async setValue < K extends keyof RooCodeSettings > ( key : K , value : RooCodeSettings [ K ] ) {
31043091 await this . contextProxy . setValue ( key , value )
3105- this . _updateViewLocalStateFromMutation ( { [ key ] : value } )
3106- await this . _persistViewLocalStateFromMutation ( { [ key ] : value } )
3092+ await this . _saveViewLocalStateFromMutation ( { [ key ] : value } )
31073093 }
31083094
31093095 public getValue < K extends keyof RooCodeSettings > ( key : K ) {
@@ -3116,8 +3102,14 @@ export class ClineProvider
31163102
31173103 public async setValues ( values : RooCodeSettings ) {
31183104 await this . contextProxy . setValues ( values )
3119- this . _updateViewLocalStateFromMutation ( values )
3105+ await this . _saveViewLocalStateFromMutation ( values )
3106+ }
3107+
3108+ private async _saveViewLocalStateFromMutation (
3109+ values : Partial < RooCodeSettings > & Partial < ExtensionState > ,
3110+ ) : Promise < void > {
31203111 await this . _persistViewLocalStateFromMutation ( values )
3112+ this . _updateViewLocalStateFromMutation ( values )
31213113 }
31223114
31233115 /**
0 commit comments