fix: early return if no api key is provided (#686)

* fix: early return if no api key is provided

* cr
This commit is contained in:
Brace Sproul 2025-08-06 10:26:13 -07:00 • committed by GitHub
parent b783d35567
commit 3c6c919fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -109,6 +109,7 @@ export function TerminalInput({
MISSING_API_KEYS_TOAST_CONTENT,
MISSING_API_KEYS_TOAST_OPTIONS,
);
return;
}
setLoading(true);

View file

@ -53,6 +53,14 @@ const API_KEY_DEFINITIONS = {
// ],
};
const shouldAutofocus = (apiKeyId: string, hasValue: boolean): boolean => {
if (apiKeyId === "anthropicApiKey") {
return !hasValue;
}
return false;
};
export function APIKeysTab() {
const { getConfig, updateConfig } = useConfigStore();
const config = getConfig(DEFAULT_CONFIG_KEY);
@ -186,6 +194,7 @@ export function APIKeysTab() {
}
placeholder={`Enter your ${apiKey.name} API key`}
className="font-mono text-sm"
autoFocus={shouldAutofocus(apiKey.id, !!apiKey.value)}
/>
<Button
variant="ghost"