mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
fix: config-manager
This commit is contained in:
@@ -65,6 +65,7 @@ export interface ExtensionStateContextType extends ExtensionState {
|
||||
setExperimentalDiffStrategy: (value: boolean) => void
|
||||
autoApprovalEnabled?: boolean
|
||||
setAutoApprovalEnabled: (value: boolean) => void
|
||||
handleInputChange: (field: keyof ApiConfiguration) => (event: any) => void
|
||||
}
|
||||
|
||||
export const ExtensionStateContext = createContext<ExtensionStateContextType | undefined>(undefined)
|
||||
@@ -117,15 +118,33 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
|
||||
|
||||
const onUpdateApiConfig = useCallback((apiConfig: ApiConfiguration) => {
|
||||
setState((currentState) => {
|
||||
console.log("onUpdateApiConfig", currentState, apiConfig)
|
||||
|
||||
vscode.postMessage({
|
||||
type: "upsertApiConfiguration",
|
||||
text: currentState.currentApiConfigName, // Access latest state
|
||||
text: currentState.currentApiConfigName,
|
||||
apiConfiguration: apiConfig,
|
||||
})
|
||||
return currentState // No state update needed
|
||||
})
|
||||
}, [])
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
(field: keyof ApiConfiguration) => (event: any) => {
|
||||
setState((currentState) => {
|
||||
console.log("handleInputChange", currentState, event)
|
||||
|
||||
vscode.postMessage({
|
||||
type: "upsertApiConfiguration",
|
||||
text: currentState.currentApiConfigName,
|
||||
apiConfiguration: { ...currentState.apiConfiguration, [field]: event.target.value },
|
||||
})
|
||||
return currentState // No state update needed
|
||||
})
|
||||
},
|
||||
[],
|
||||
)
|
||||
|
||||
const handleMessage = useCallback(
|
||||
(event: MessageEvent) => {
|
||||
const message: ExtensionMessage = event.data
|
||||
@@ -258,6 +277,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
|
||||
setExperimentalDiffStrategy: (value) =>
|
||||
setState((prevState) => ({ ...prevState, experimentalDiffStrategy: value })),
|
||||
setAutoApprovalEnabled: (value) => setState((prevState) => ({ ...prevState, autoApprovalEnabled: value })),
|
||||
handleInputChange,
|
||||
}
|
||||
|
||||
return <ExtensionStateContext.Provider value={contextValue}>{children}</ExtensionStateContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user