File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ export class Cline {
143143 const newConfig = await provider . getState ( )
144144 if ( newConfig ?. apiConfiguration ) {
145145 this . api = buildApiHandler ( newConfig . apiConfiguration )
146+ // Force provider to update webview state
147+ await provider . postStateToWebview ( )
146148 }
147149 }
148150 } ) ,
Original file line number Diff line number Diff line change @@ -1525,6 +1525,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
15251525 if ( this . cline ) {
15261526 this . cline . api = buildApiHandler ( apiConfiguration )
15271527 }
1528+
1529+ // Force a state refresh after updating configuration
1530+ await this . postStateToWebview ( )
15281531 }
15291532
15301533 async updateCustomInstructions ( instructions ?: string ) {
@@ -1986,8 +1989,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19861989 }
19871990
19881991 async postStateToWebview ( ) {
1989- const state = await this . getStateToPostToWebview ( )
1990- this . postMessageToWebview ( { type : "state" , state } )
1992+ try {
1993+ const state = await this . getStateToPostToWebview ( )
1994+ await this . postMessageToWebview ( { type : "state" , state } )
1995+ } catch ( error ) {
1996+ console . error ( "Error posting state to webview:" , error )
1997+ }
19911998 }
19921999
19932000 async getStateToPostToWebview ( ) {
You can’t perform that action at this time.
0 commit comments