🐛 修复网站匹配/排除重置后清空列表(应回落脚本自带规则)#1579
Open
CodFrm wants to merge 1 commit into
Open
Conversation
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 / 描述
脚本设置 → 网站匹配 / 排除,点击「重置」时列表被整个清空,连脚本自带的
@match/@exclude规则也一并消失。根因(
SettingsPane.tsx的setMatchList):重置按钮调用setMatchList(kind, undefined)。后端resetMatch/resetExclude(uuid, undefined)会删除用户覆盖(selfMetadataUpdate传空集即删除该 key),使生效列表回落到脚本自带的metadata.match/metadata.exclude。但前端用next ?? [],重置时把可见列表置空并写入selfMetadata[kind] = [],与后端持久化结果不一致,导致脚本自带规则也被隐藏。修复:前端乐观更新对齐后端
selfMetadataUpdate语义——重置时把可见列表回落到脚本自带的metadata值并删除覆盖,而非置空为[]。新增 / 删除路径(传入真实数组)行为不变。测试(TDD,先写失败用例再修):
SettingsPane.test.tsx全量 27/27 通过;ESLint、tsc --noEmit均无报错。Screenshots / 截图
N/A(逻辑修复,无 UI 视觉变化)