Repository navigation
fix(proxy-pool): 修复代理池页 React #310 渲染异常 - #59
Merged
Merged
Conversation
11 tasks done
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.
负责:Hark/proxyfix · 完成 2026-12-03 11:25 北京
现象
设置 → 代理池页面经常整页变成「管理控制台渲染异常 · Minified React error #310」。
原因
ProxyPoolSection.tsx在if (!active) return null之后还调用了 4 个 hook(2 个 useState、useAutoRuleSummary、useRef)。切到/切离代理池页时 active 变化,两次渲染 hook 数量不同,React 抛 #310。引入于 #43(1085c2d)。改动
src/renderer/src/hooksOrder.test.ts:扫描 renderer 全部 .tsx 组件,凡在提前if (...) return之后调用 hook 的都报出来,防止再犯。全仓库目前只有这一处。验证(云电脑,2026-12-03 北京)
npx vitest run src/renderer/src/hooksOrder.test.ts:通过,退出码 0npm run typecheck:退出码 0npx vitest run src/renderer src/shared src/preload:84 个文件 587 个测试通过,退出码 0npx electron-vite build:退出码 0