Conversation
排序状态会跨会话持久化,原按钮在排序与未排序时外观相同,用户忘了排序开着时会误以为拖拽手柄消失是功能损坏。 Refs #1751
排序激活时手柄原本直接隐藏,看起来像拖拽功能失效。现在手柄保留为锁定态:悬停说明原因,按下(或键盘回车/空格)弹出带「切回默认顺序」操作的提示。按最后更新排序时时间列加粗,让排序依据在行内可见。 Refs #1751
行级 memo 改用 React 默认浅比较,避免配置或父级依赖变化后继续调用旧的 onDelete/onEnable/onRunStop 等闭包,并补回归测试覆盖同一脚本对象下回调更新。 Refs #1751
排序状态下改渲染普通行,只保留锁定手柄及切回默认顺序的反馈;DndContext、SortableContext 和 useSortable 仅在默认顺序下挂载,对齐仓库的拖拽性能约定。 Refs #1751
回收站用 null 表示默认排序,并在该状态稳定按删除时间倒序展示,避免共享 SortMenu 的重置按钮把默认顺序切成接口原始顺序;补回归测试覆盖名称排序后重置。 Refs #1751
Member
Author
改用行复选框直接观察 ScriptRow 的 onSelect prop,避免此前通过 EnableSwitch 内部路径间接断言 updateScripts 而没有触发目标回调;同时保持其它回调引用稳定,让测试确实能拒绝旧的自定义 memo 比较。 Refs #1751
Collaborator
|
按
最终核对:
本执行环境无法直接 DNS clone GitHub 仓库,因此没有把“本地命令运行”作为验证证据;上面的执行结果来自当前最终 head 的 GitHub CI。 |
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.

Checklist / 检查清单
Description / 描述
close #1751
背景
脚本列表的排序状态会跨会话持久化,但排序按钮在「默认」和「已排序」两种状态下外观相同。排序时拖拽手柄又被
collapse直接隐藏。结果就是用户忘了排序开着,看到手柄没了,以为拖拽功能坏了(见 issue 讨论)。排序规则本身要保留,所以这次只让两种模式的状态和切换方式更清楚,排序时仍然不允许拖拽。本次改动
两个提交,可以分开审:
SortMenu):排序时按钮变成主色浅底加主色描边,文字后面直接显示 ↑/↓ 方向;右侧加一个 ✕(重置排序),一步回到默认顺序。未排序时外观不变。回收站和订阅页用的也是SortMenu,会一起得到这个激活态。ScriptTable)sort.ts的scriptSortOptions(t),工具栏和提示文案共用一份。sort_reset、drag_locked_by_sort、drag_locked_toast、drag_locked_action),10 个语言都补齐了。措辞沿用已有network_rules_drag_handle的「调整顺序 / reorder」说法。建议审查重点
ScriptRow的 memo 比较新增了emphasizeUpdateTime。脚本对象不变、只切换排序时,行必须重新渲染;对应的测试在把比较改回旧写法时会失败,我验证过。aria-disabled而不是disabled,这样按下时仍能收到事件并给出反馈。已知限制
DndContext/SortableContext(这是既有行为,与仓库里「拖拽禁用时渲染普通行」的约定不一致),本 PR 没有处理,留作后续。Screenshots / 截图
在
pnpm run build后的扩展里(装了 3 个脚本)用e2e/session.mjs会话实际操作并截图确认过,截图存在本地,没有上传:验证
分支 head
3204421a,baseorigin/maind6cc48ba:SortMenu.test.tsx新增 3 条(2 条实现前失败),ScriptTable.test.tsx新增 5 条(实现前全部失败),实现后全部通过。pnpm run lint:通过(prettier、tsc、check:i18n、check:issue-templates、eslint)。pnpm exec vitest run --no-coverage src/pages/options/routes/ScriptList src/pages/options/routes/SubscribeList src/locales:207/207 通过,连跑 2 次。pnpm run test:ci:第 1 次 4860/4862,i18n-usage.test.ts和trash_event_partition.test.ts各有 1 条超出 340ms 预算,当时机器负载均值是 12–20。两个文件单独运行 3 次,本分支耗时 24–69ms,main耗时 24–39ms,都通过。在较低负载下重跑,第 2 次 4862/4862 通过。据此判断是负载导致的超时,不是本改动引起的。ScriptTable.test.tsx里既有的「未排序时保持拖拽得到的自然顺序」和新增的「按下锁定手柄…」偶尔会超出 850ms 的 ui 预算。对比测过,前者在分支和main上耗时分布相同(138–470ms 对 118–427ms),后者正常耗时 47–680ms。都只在机器高负载时出现,CI 上如果复现需要另行处理。git diff --stat origin/main...HEAD共 17 个文件,全部在src/locales/*/script.json和src/pages/options/routes/ScriptList/下。