[v1.3] ScriptEditor: 脚本名称冲突 (合并至 develop/scripteditor-1)#1223
Open
cyfung1031 wants to merge 2 commits intoscriptscat:develop/scripteditor-1from
Open
[v1.3] ScriptEditor: 脚本名称冲突 (合并至 develop/scripteditor-1)#1223cyfung1031 wants to merge 2 commits intoscriptscat:develop/scripteditor-1from
cyfung1031 wants to merge 2 commits intoscriptscat:develop/scripteditor-1from
Conversation
Collaborator
cyfung1031
commented
Feb 7, 2026
- 新增/更改名字时,有相同名字的脚本的话,提醒一下是否真的储存
- [Feature] 提醒有相同名字的腳本 (安裝/更新/改代碼) #808
b0d2926 to
b563ab1
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 在 ScriptEditor 的保存流程中新增“脚本名称 + namespace 冲突”检测:当新增脚本或修改脚本名称/命名空间时,如发现已有同名同命名空间脚本,则弹窗提醒用户是否仍要保存,以避免同页重复运行脚本的问题(#808)。
Changes:
- 保存时检测同名同 namespace 脚本,冲突时弹出确认对话框,可选择继续保存或中止保存
- 为该提示补充多语言文案(zh-CN/zh-TW/en-US/de-DE/ja-JP/ru-RU/vi-VN/ach-UG)
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/pages/options/routes/script/ScriptEditor.tsx | 在保存逻辑中加入脚本名称冲突检测与确认弹窗 |
| src/locales/zh-TW/translation.json | 新增脚本名称冲突相关文案(繁中) |
| src/locales/zh-CN/translation.json | 新增脚本名称冲突相关文案(简中) |
| src/locales/vi-VN/translation.json | 新增脚本名称冲突相关文案(越南语) |
| src/locales/ru-RU/translation.json | 新增脚本名称冲突相关文案(俄语) |
| src/locales/ja-JP/translation.json | 新增脚本名称冲突相关文案(日语) |
| src/locales/en-US/translation.json | 新增脚本名称冲突相关文案(英文) |
| src/locales/de-DE/translation.json | 新增脚本名称冲突相关文案(德文) |
| src/locales/ach-UG/translation.json | 新增脚本名称冲突相关文案(ach-UG) |
| setTimeout(e.focus.bind(e), 50); | ||
| if (modalResult === "no") { | ||
| Message.warning(t("save_abort_when_scriptname_conflict")); | ||
| return Promise.reject(new Error("This script name is already used by another script. Save aborted.")); |
There was a problem hiding this comment.
这里在用户选择“不保存”时通过 Promise.reject(new Error(...)) 中止流程,会被外层 save() 的 .catch() 统一当作 invalid_script_code 处理并弹出错误提示;同时 run 菜单里 await save(...) 没有兜底 catch,取消保存会导致运行流程抛错/潜在未处理的 Promise rejection。建议为“用户主动取消保存”使用可识别的中止信号(如专用错误类型/错误码),并在 save() 的 catch 中对该类中止分支直接静默返回/仅保留 warning,不要走 invalid_script_code 提示;调用方(如 run)也应捕获并直接 return。
Suggested change
| return Promise.reject(new Error("This script name is already used by another script. Save aborted.")); | |
| // 用户主动取消保存:中止当前保存流程,但不触发 Promise rejection | |
| return; |
Member
|
有问题 这个脚本我有多个版本,如果就是想保留几个不同的版本,体验不是很好(等有用户提再优化也行),似乎 编辑冲突也有些问题 没太细看,我先看其它pr 1234.mp4 |
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.