diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 4bdff0b061..277a532c48 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -128,7 +128,10 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) = id="api-provider" value={selectedProvider} onChange={(value: unknown) => { - handleInputChange("apiProvider")({ + handleInputChange( + "apiProvider", + true, + )({ target: { value: (value as DropdownOption).value, }, diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 47db6bf6bb..c7daf643e3 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -71,7 +71,7 @@ export interface ExtensionStateContextType extends ExtensionState { setEnhancementApiConfigId: (value: string) => void setExperimentEnabled: (id: ExperimentId, enabled: boolean) => void setAutoApprovalEnabled: (value: boolean) => void - handleInputChange: (field: keyof ApiConfiguration) => (event: any) => void + handleInputChange: (field: keyof ApiConfiguration, softUpdate?: boolean) => (event: any) => void customModes: ModeConfig[] setCustomModes: (value: ModeConfig[]) => void } @@ -142,7 +142,16 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode }, []) const handleInputChange = useCallback( - (field: keyof ApiConfiguration) => (event: any) => { + (field: keyof ApiConfiguration, softUpdate?: boolean) => (event: any) => { + if (softUpdate === true) { + setState((currentState) => { + return { + ...currentState, + apiConfiguration: { ...currentState.apiConfiguration, [field]: event.target.value }, + } + }) + return + } setState((currentState) => { vscode.postMessage({ type: "upsertApiConfiguration",