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

fix: prevent unnecessary config operations when renaming to same name
This commit is contained in:
Matt Rubens 2025-01-31 23:04:02 -05:00 committed by GitHub
commit 11fd3607ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -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)

View file

@ -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)
}