ENG-464 Fix Settings state issue with API provider reseting other settings. (#3004)
* added a a difference between react state saves and core state saves so that the provider settings dont reset other set settings * added changeset * Update .changeset/thirty-bugs-admire.md Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * changed button text to say Save --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
e70264a56c
commit
cff8a237cd
4 files changed
+24
-8
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
Fixed bug causing saved settings to get reset by changing providers
|
||||
@@ -1378,6 +1378,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
apiErrorMessage={undefined}
|
||||
modelIdErrorMessage={undefined}
|
||||
isPopup={true}
|
||||
saveImmediately={true} // Ensure popup saves immediately
|
||||
/>
|
||||
</ModelSelectorTooltip>
|
||||
)}
|
||||
|
||||
@@ -66,6 +66,7 @@ interface ApiOptionsProps {
|
||||
apiErrorMessage?: string
|
||||
modelIdErrorMessage?: string
|
||||
isPopup?: boolean
|
||||
saveImmediately?: boolean // Add prop to control immediate saving
|
||||
}
|
||||
|
||||
// This is necessary to ensure dropdown opens downward, important for when this is used in popup
|
||||
@@ -92,8 +93,16 @@ declare module "vscode" {
|
||||
}
|
||||
}
|
||||
|
||||
const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, isPopup }: ApiOptionsProps) => {
|
||||
const { apiConfiguration, setApiConfiguration, uriScheme } = useExtensionState()
|
||||
const ApiOptions = ({
|
||||
showModelOptions,
|
||||
apiErrorMessage,
|
||||
modelIdErrorMessage,
|
||||
isPopup,
|
||||
saveImmediately = false, // Default to false
|
||||
}: ApiOptionsProps) => {
|
||||
// Use full context state for immediate save payload
|
||||
const extensionState = useExtensionState()
|
||||
const { apiConfiguration, setApiConfiguration, uriScheme } = extensionState
|
||||
const [ollamaModels, setOllamaModels] = useState<string[]>([])
|
||||
const [lmStudioModels, setLmStudioModels] = useState<string[]>([])
|
||||
const [vsCodeLmModels, setVsCodeLmModels] = useState<vscodemodels.LanguageModelChatSelector[]>([])
|
||||
@@ -115,14 +124,15 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
[field]: newValue,
|
||||
})
|
||||
|
||||
// If the field is the provider, save it immediately
|
||||
// Necessary for favorite model selection to work without undoing provider changes
|
||||
if (field === "apiProvider") {
|
||||
// If the field is the provider AND saveImmediately is true, save it immediately using the full context state
|
||||
if (saveImmediately && field === "apiProvider") {
|
||||
// Use apiConfiguration from the full extensionState context to send the most complete data
|
||||
const currentFullApiConfig = extensionState.apiConfiguration
|
||||
vscode.postMessage({
|
||||
type: "apiConfiguration",
|
||||
apiConfiguration: {
|
||||
...apiConfiguration,
|
||||
apiProvider: newValue,
|
||||
...currentFullApiConfig, // Send the most complete config available
|
||||
apiProvider: newValue, // Override with the new provider
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
<div className="fixed top-0 left-0 right-0 bottom-0 pt-[10px] pr-0 pb-0 pl-5 flex flex-col overflow-hidden">
|
||||
<div className="flex justify-between items-center mb-[13px] pr-[17px]">
|
||||
<h3 className="text-[var(--vscode-foreground)] m-0">Settings</h3>
|
||||
<VSCodeButton onClick={() => handleSubmit(false)}>Done</VSCodeButton>
|
||||
<VSCodeButton onClick={() => handleSubmit(false)}>Save</VSCodeButton>
|
||||
</div>
|
||||
<div className="grow overflow-y-scroll pr-2 flex flex-col">
|
||||
{/* Tabs container */}
|
||||
|
||||
Reference in new issue
Block a user