Skip to content

Commit c9bc90f

Browse files
committed
fix: correct OAuth path default behavior on blur
- Changed value prop to show empty string instead of default path - Default path only appears as placeholder - On blur, if field is empty, it sets the default path in config - Removed redundant element.value assignment in handleBlur This prevents the default path from immediately appearing while typing/deleting
1 parent e2289f6 commit c9bc90f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

webview-ui/src/components/settings/providers/QwenCode.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ interface QwenCodeProps {
88
}
99

1010
export const QwenCode: React.FC<QwenCodeProps> = ({ apiConfiguration, setApiConfigurationField }) => {
11+
const defaultPath = "~/.qwen/oauth_creds.json"
12+
1113
const handleInputChange = (e: Event | React.FormEvent<HTMLElement>) => {
1214
const element = e.target as HTMLInputElement
1315
setApiConfigurationField("qwenCodeOauthPath", element.value)
1416
}
1517

18+
const handleBlur = (e: Event | React.FormEvent<HTMLElement>) => {
19+
const element = e.target as HTMLInputElement
20+
// If the field is empty on blur, set it to the default value
21+
if (!element.value || element.value.trim() === "") {
22+
setApiConfigurationField("qwenCodeOauthPath", defaultPath)
23+
}
24+
}
25+
1626
return (
1727
<div className="flex flex-col gap-4">
1828
<div>
@@ -21,7 +31,8 @@ export const QwenCode: React.FC<QwenCodeProps> = ({ apiConfiguration, setApiConf
2131
style={{ width: "100%", marginTop: 3 }}
2232
type="text"
2333
onInput={handleInputChange}
24-
placeholder="~/.qwen/oauth_creds.json">
34+
onBlur={handleBlur}
35+
placeholder={defaultPath}>
2536
OAuth Credentials Path
2637
</VSCodeTextField>
2738

@@ -31,7 +42,7 @@ export const QwenCode: React.FC<QwenCodeProps> = ({ apiConfiguration, setApiConf
3142
marginTop: 3,
3243
color: "var(--vscode-descriptionForeground)",
3344
}}>
34-
Path to your Qwen OAuth credentials file. Use ~/.qwen/oauth_creds.json or provide a custom path.
45+
Path to your Qwen OAuth credentials file. Defaults to ~/.qwen/oauth_creds.json if left empty.
3546
</p>
3647

3748
<div style={{ fontSize: "12px", color: "var(--vscode-descriptionForeground)", marginTop: "12px" }}>

0 commit comments

Comments
 (0)