feat: 允许重命名实例时使用原名#5137
Merged
Glavo merged 1 commit intoHMCL-dev:mainfrom Jan 7, 2026
Merged
Conversation
Contributor
|
感觉原名不给校验提示就可以,确定按钮应继续保持禁用状态。 |
Contributor
Author
但是禁用状态与校验器状态绑定,没办法在校验器不报错时禁用确定按钮 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the user experience when renaming game instances by allowing users to keep the original name without triggering a validation error. Previously, when the rename dialog opened with the instance's current name pre-filled, the validator would immediately show an "instance already exists" error, which was confusing since users typically expect "duplicate name" to mean a conflict with a different instance.
Key changes:
- Modified the validator to allow the original name as a valid input
- Added early return logic to skip unnecessary file system operations when the name hasn't changed
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Glavo
approved these changes
Jan 7, 2026
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.
在之前的逻辑中,当用户点击“重命名实例”时,弹窗默认显示的名称是实例的原名。由于校验器会检查名称是否已存在,导致用户一打开弹窗就会看到“此实例已存在”的错误提示。
此外,用户通常认为“重名”是指与其他实例名称冲突,保持原名不应被视为错误。这不符合用户的使用习惯,且容易造成误导。
现在会进行判断,如果是原名则什么都不做。