chore(frontend): remove 6 unmounted components + 3 orphaned CSS modules - #234
Open
flyhigher139 wants to merge 1 commit into
Open
flyhigher139 wants to merge 1 commit into
flyhigher139 wants to merge 1 commit into
Conversation
Deleting -1309 lines of code that no route or component can reach. #230 item 7 (P-F6, ApplyStatus) already proposed this. Items 4 and the underlying finding are broader than that, and both need reclassifying: - Item 4 (P-F7) claimed ProfileEdit "silently discards unsaved name/description edits" and asked for it to outrank the rest of the perf batch. ProfileEdit has had zero importers since 1bfe932 (the #55 sidebar/drawer redesign) — no route, no import, no test, no dynamic import. The live editing components are not affected: HostsProfileView already seeds draft rules on `[profile?.id]` (not `[profile]`) and seeds draftInfo on-demand in handleEditInfo rather than in an effect, and DnsProfileView has no useEffect at all. There was no user-facing data loss to fix. The underlying cause is an audit-process gap, not a code defect: both the #90 review and the 2026-09-28 review scanned files rather than reachability, so each produced findings against code that never runs. Deleting the code removes the false positives rather than patching them. Removed: pages/ProfileEdit.tsx orphaned by 1bfe932 (#55 redesign) components/BasicInfoForm.tsx only importer was ProfileEdit components/RuleList.tsx existed only to import ProfileEdit's CSS components/ProfileCard.tsx superseded by DrawerProfileCard components/CreateProfileForm.tsx components/ApplyStatus.tsx unmounted; see #230 item 7 __tests__/ApplyStatus.test.tsx 283 lines covering a never-rendered component, which is why the dead component kept looking maintained CSS modules orphaned by the above: pages/ProfileEdit.module.css only ProfileEdit + RuleList pages/ProfileList.module.css only ProfileCard + CreateProfileForm components/ApplyStatus.module.css Not removed: the global `.toggle` / `.toggle-slider` classes. The comment credited ProfileCard, but AdBlock is the live consumer (pages/AdBlock.tsx :326, :597, :790), so only the comment is corrected. Verification: pnpm test 353 passed / 26 files, pnpm build (tsc + vite) clean. No Rust touched.
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.
背景
昨天(2026-09-28)的性能复审开了 #224–#230 共 7 个 issue。复核其中 #230 第 4 项(P-F7) 时发现它指向的代码从未被挂载,因此这个 PR 不是「修 bug」,而是删死代码 + 把该 issue 重新定性。
P-F7 的实际状态
src/pages/ProfileEdit.tsx自 commit1bfe932(#55 sidebar/drawer UI 重构)起就没有任何引用——无路由、无 import、无测试、无动态 import。Issue 原文把它描述为「用户未保存的 name/description 编辑可能丢失」,并建议优先于 #230 其余各项处理。实际情况:
pages/ProfileEdit.tsxcomponents/HostsProfileView.tsxcomponents/DnsProfileView.tsx活代码本来就已经免疫:
HostsProfileView.tsx:100-113— 播种 effect 依赖已是[profile?.id],不是[profile]HostsProfileView.tsx:155-166—draftInfo在用户点「编辑」时按需播种,不经过 effectDnsProfileView.tsx— 全文 0 个useEffect所以不存在用户数据丢失。此前的优先级判断(建议它插队先合)建立在错误前提上,在此更正。
根因:审计流程缺口,不是代码缺陷
#90 复审与本次 2026-09-28 复审都是按文件扫描而非按可达性扫描,于是连续两轮在从不运行的代码上「发现」了问题:
ApplyStatus.tsx([perf] 前端杂项:AdBlock 组件渲染模式 + #90 残留小项(归并) #230 第 7 项已提出删除)ProfileEdit.tsx删代码比逐个修补这些幻影更彻底。
变更内容
删除 6 个组件:
pages/ProfileEdit.tsx1bfe932(#55) 后解绑components/BasicInfoForm.tsxcomponents/RuleList.tsxcomponents/ProfileCard.tsxDrawerProfileCard取代components/CreateProfileForm.tsxcomponents/ApplyStatus.tsx删除 283 行测死代码的测试 —— 这是
ApplyStatus.tsx长期「看起来还在维护」的原因:它有测试,但那个测试从不参与真实渲染。删除 3 个随之孤立的 CSS module:
ProfileEdit.module.css、ProfileList.module.css、ApplyStatus.module.css。保留全局
.toggle/.toggle-slider:注释原写「used by ProfileCard」,但实际消费者是pages/AdBlock.tsx(:326 / :597 / :790),只更正注释。净:12 files changed, +2 / −1309。
验证
pnpm test— 26 files / 353 tests 全绿pnpm build(tsc && vite build)— 无悬空 import,构建通过src/pages+src/components:无未挂载组件残留回滚
若日后要恢复独立编辑页,
git revert本 PR 的单个提交即可完整取回(含 CSS 与测试)。判断依据已写在 commit message 中:零引用、零测试、编辑能力已被HostsProfileView/DnsProfileView完整覆盖、且是被一次显式重构解绑而非意外遗漏。关联
覆盖 #230 第 4、7 项。第 4 项将以「指向死代码,已随删除消解」重新定性,不再作为 perf 项排期。
🤖 Generated with Claude Code