fix: 不再强制填写后端会自动补齐的 Profile 名称 - #8
Merged
Merged
Conversation
The label input was marked required and canSave demanded it, but the write path treats it as optional: an empty label falls back to the existing one, then to the Profile ID (internal/profile/write.go:71-74). Editing a Profile to clear its name was therefore impossible even though saving it would have worked. The hint spells the fallback out, otherwise a Profile saved without a name looks like it lost one. model keeps its required attribute: Store.Save has no fallback for it and rejects an empty value outright (write.go:50-53). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
改动
ProfilesPage的名称输入去掉required,canSave门禁去掉 label 条件。后端
Store.Save本来就把 label 当可选:留空则沿用已存的 label,再退到 Profile ID(internal/profile/write.go:71-74)。前端却拦着不让保存,导致「把某个 Profile 的名字清空」这个操作根本做不到——尽管真正走到写入会成功。补了一行提示说明留空的后果,否则用户保存后看到名字变成了 ID,会以为是丢了数据。
未改动的部分
model保留required。它在后端没有 fallback,空值直接被拒(write.go:50-53),放开会把前端拦截变成后端报错,体验更差。ProvidersPage的三个必填项(id/name/base_url)全部保留。核对后确认它们在internal/provider/store.go:208-216是真必填,放开会导致写入失败——那是回归而非改进。#7 里有完整的逐字段核对表。验证
tsc --noEmit与生产构建通过go test ./internal/profile/...通过后端的 label fallback 已有测试覆盖(
internal/profile/write_test.go:205),没有重复添加。🤖 Generated with Claude Code