浏览代码

Merge pull request #697 from samhvw8/fix/config-profile-rename-bug

fix: prevent unnecessary config operations when renaming to same name
Matt Rubens 11 月之前
父节点
当前提交
11fd3607ea
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 4 0
      src/core/webview/ClineProvider.ts
  2. 5 0
      webview-ui/src/components/settings/ApiConfigManager.tsx

+ 4 - 0
src/core/webview/ClineProvider.ts

@@ -1222,6 +1222,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
 							try {
 								const { oldName, newName } = message.values
 
+								if (oldName === newName) {
+									break
+								}
+
 								await this.configManager.saveConfig(newName, message.apiConfiguration)
 								await this.configManager.deleteConfig(oldName)
 

+ 5 - 0
webview-ui/src/components/settings/ApiConfigManager.tsx

@@ -60,6 +60,11 @@ const ApiConfigManager = ({
 		if (editState === "new") {
 			onUpsertConfig(trimmedValue)
 		} else if (editState === "rename" && currentApiConfigName) {
+			if (currentApiConfigName === trimmedValue) {
+				setEditState(null)
+				setInputValue("")
+				return
+			}
 			onRenameConfig(currentApiConfigName, trimmedValue)
 		}