Skip to content

Commit 7646a2e

Browse files
committed
fix: config-manager
1 parent 87b1a4d commit 7646a2e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
5656
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
5757
const apiConfig = { ...apiConfiguration, [field]: event.target.value }
5858
onUpdateApiConfig(apiConfig)
59-
setApiConfiguration(apiConfig)
59+
// setApiConfiguration(apiConfig)
6060
}
6161

6262
const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => {

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
112112

113113
const setListApiConfigMeta = useCallback(
114114
(value: ApiConfigMeta[]) => setState((prevState) => ({ ...prevState, listApiConfigMeta: value })),
115-
[setState],
115+
[],
116116
)
117117

118-
const onUpdateApiConfig = useCallback(
119-
(apiConfig: ApiConfiguration) => {
118+
const onUpdateApiConfig = useCallback((apiConfig: ApiConfiguration) => {
119+
setState((currentState) => {
120120
vscode.postMessage({
121121
type: "upsertApiConfiguration",
122-
text: state.currentApiConfigName,
122+
text: currentState.currentApiConfigName, // Access latest state
123123
apiConfiguration: apiConfig,
124124
})
125-
},
126-
[state],
127-
)
125+
return currentState // No state update needed
126+
})
127+
}, [])
128128

129129
const handleMessage = useCallback(
130130
(event: MessageEvent) => {

0 commit comments

Comments
 (0)