Compare commits

...

4 Commits

Author SHA1 Message Date
NightTrek 873a0b507e changed button text to say Save 2025-04-21 10:53:34 -07:00
Daniel Steigman 083bc2fadc Update .changeset/thirty-bugs-admire.md
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-04-20 00:43:18 -07:00
NightTrek bb6f8082cb added changeset 2025-04-19 19:50:59 -07:00
NightTrek 7fa23cfb97 added a a difference between react state saves and core state saves so that the provider settings dont reset other set settings 2025-04-19 19:35:03 -07:00
4 changed files with 24 additions and 8 deletions
+5
View File
@@ -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 */}