Skip to content

Commit ab55628

Browse files
committed
fix: prevent unnecessary config operations when renaming to same name
- Add validation in UI to early return when renaming config to current name - Add server-side validation to prevent config save/delete operations
1 parent 8ce5f9a commit ab55628

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
12151215
try {
12161216
const { oldName, newName } = message.values
12171217

1218+
if (oldName === newName) {
1219+
break
1220+
}
1221+
12181222
await this.configManager.saveConfig(newName, message.apiConfiguration)
12191223
await this.configManager.deleteConfig(oldName)
12201224

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ const ApiConfigManager = ({
6060
if (editState === "new") {
6161
onUpsertConfig(trimmedValue)
6262
} else if (editState === "rename" && currentApiConfigName) {
63+
if (currentApiConfigName === trimmedValue) {
64+
setEditState(null)
65+
setInputValue("")
66+
return
67+
}
6368
onRenameConfig(currentApiConfigName, trimmedValue)
6469
}
6570

0 commit comments

Comments
 (0)